Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 548 → Rev 550

/programs/games/doom/trunk/kolibc/include/sound.h
File deleted
/programs/games/doom/trunk/kolibc/include/kolibri.h
File deleted
/programs/games/doom/trunk/kolibc/include/mf.h
File deleted
/programs/games/doom/trunk/kolibc/include/kolibc.h
File deleted
/programs/games/doom/trunk/d_main.c
1168,9 → 1168,9
if (p && p < myargc-1)
{
if (M_CheckParm("-cdrom"))
sprintf(file, "c:\\doomdata\\"SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
sprintf(file, "c:\\doomdata\\doomsav%c.dsg",myargv[p+1][0]);
else
sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
sprintf(file, "doomsav%c.dsg",myargv[p+1][0]);
G_LoadGame (file);
}
/programs/games/doom/trunk/g_game.c
1206,7 → 1206,7
char vcheck[VERSIONSIZE];
gameaction = ga_nothing;
length = M_ReadFile (savename, &savebuffer);
save_p = savebuffer + SAVESTRINGSIZE;
1266,20 → 1266,20
strcpy (savedescription, description);
sendsave = true;
}
 
void G_DoSaveGame (void)
{
char name[100];
char name[128];
char name2[VERSIONSIZE];
char* description;
int length;
int i;
sprintf (name,"%d.dsg",savegameslot);
sprintf (name,"doomsav%d.dsg",savegameslot);
description = savedescription;
save_p = savebuffer = screens[1]+0x4000;
 
memcpy (save_p, description, SAVESTRINGSIZE);
save_p += SAVESTRINGSIZE;
memset (name2,0,sizeof(name2));
1305,7 → 1305,8
length = save_p - savebuffer;
if (length > SAVEGAMESIZE)
I_Error ("Savegame buffer overrun");
I_Error ("Savegame buffer overrun");
M_WriteFile (name, savebuffer, length);
gameaction = ga_nothing;
savedescription[0] = 0;
/programs/games/doom/trunk/h/kolibri.h
File deleted
/programs/games/doom/trunk/h/dstrings.h
18,7 → 18,7
// $Log:$
//
// DESCRIPTION:
// DOOM strings, by language.
// DOOM strings, by language.
//
//-----------------------------------------------------------------------------
 
38,7 → 38,7
#endif
 
// Misc. other strings.
#define SAVEGAMENAME "doomsav"
//#define SAVEGAMENAME "doomsav"
 
 
//
/programs/games/doom/trunk/m_menu.c
17,8 → 17,8
// $Log:$
//
// DESCRIPTION:
// DOOM selection menu, options, episode etc.
// Sliders and icons. Kinda widget stuff.
// DOOM selection menu, options, episode etc.
// Sliders and icons. Kinda widget stuff.
//
//-----------------------------------------------------------------------------
 
60,46 → 60,46
 
 
 
extern patch_t* hu_font[HU_FONTSIZE];
extern boolean message_dontfuckwithme;
extern patch_t* hu_font[HU_FONTSIZE];
extern boolean message_dontfuckwithme;
 
extern boolean chat_on; // in heads-up code
extern boolean chat_on; // in heads-up code
 
//
// defaulted values
//
int mouseSensitivity; // has default
int mouseSensitivity; // has default
 
// Show messages has default, 0 = off, 1 = on
int showMessages;
int showMessages;
 
// Blocky mode, has default, 0 = high, 1 = normal
int detailLevel;
int screenblocks; // has default
int detailLevel;
int screenblocks; // has default
 
// temp for screenblocks (0-9)
int screenSize;
int screenSize;
 
// -1 = no quicksave slot picked!
int quickSaveSlot;
int quickSaveSlot;
 
// 1 = message to be printed
int messageToPrint;
int messageToPrint;
// ...and here is the message string!
char* messageString;
char* messageString;
 
// message x & y
int messx;
int messy;
int messageLastMenuActive;
int messx;
int messy;
int messageLastMenuActive;
 
// timed message = no input from user
boolean messageNeedsInput;
boolean messageNeedsInput;
 
void (*messageRoutine)(int response);
 
#define SAVESTRINGSIZE 24
#define SAVESTRINGSIZE 24
 
char gammamsg[5][26] =
{
111,22 → 111,22
};
 
// we are going to be entering a savegame string
int saveStringEnter;
int saveSlot; // which slot to save in
int saveCharIndex; // which char we're editing
int saveStringEnter;
int saveSlot; // which slot to save in
int saveCharIndex; // which char we're editing
// old save description before edit
char saveOldString[SAVESTRINGSIZE];
char saveOldString[SAVESTRINGSIZE];
 
boolean inhelpscreens;
boolean menuactive;
boolean inhelpscreens;
boolean menuactive;
 
#define SKULLXOFF -32
#define LINEHEIGHT 16
#define SKULLXOFF -32
#define LINEHEIGHT 16
 
extern boolean sendpause;
char savegamestrings[10][SAVESTRINGSIZE];
extern boolean sendpause;
char savegamestrings[10][SAVESTRINGSIZE];
 
char endstring[160];
char endstring[160];
 
 
//
135,17 → 135,17
typedef struct
{
// 0 = no cursor here, 1 = ok, 2 = arrows ok
short status;
short status;
char name[10];
char name[10];
// choice = menu item #.
// if status = 2,
// choice=0:leftarrow,1:rightarrow
void (*routine)(int choice);
void (*routine)(int choice);
// hotkey in menu
char alphaKey;
char alphaKey;
} menuitem_t;
 
 
152,18 → 152,18
 
typedef struct menu_s
{
short numitems; // # of menu items
struct menu_s* prevMenu; // previous menu
menuitem_t* menuitems; // menu items
void (*routine)(); // draw routine
short x;
short y; // x,y of menu
short lastOn; // last item user was on in menu
short numitems; // # of menu items
struct menu_s* prevMenu; // previous menu
menuitem_t* menuitems; // menu items
void (*routine)(); // draw routine
short x;
short y; // x,y of menu
short lastOn; // last item user was on in menu
} menu_t;
 
short itemOn; // menu item skull is on
short skullAnimCounter; // skull animation counter
short whichSkull; // which skull to draw
short itemOn; // menu item skull is on
short skullAnimCounter; // skull animation counter
short whichSkull; // which skull to draw
 
// graphic name of skulls
// warning: initializer-string for array of chars is too long
170,7 → 170,7
char skullName[2][/*8*/9] = {"M_SKULL1","M_SKULL2"};
 
// current menudef
menu_t* currentMenu;
menu_t* currentMenu;
 
//
// PROTOTYPES
286,12 → 286,12
 
menu_t EpiDef =
{
ep_end, // # of menu items
&MainDef, // previous menu
EpisodeMenu, // menuitem_t ->
M_DrawEpisode, // drawing routine ->
ep_end, // # of menu items
&MainDef, // previous menu
EpisodeMenu, // menuitem_t ->
M_DrawEpisode, // drawing routine ->
48,63, // x,y
ep1 // lastOn
ep1 // lastOn
};
 
//
309,21 → 309,21
 
menuitem_t NewGameMenu[]=
{
{1,"M_JKILL", M_ChooseSkill, 'i'},
{1,"M_ROUGH", M_ChooseSkill, 'h'},
{1,"M_HURT", M_ChooseSkill, 'h'},
{1,"M_ULTRA", M_ChooseSkill, 'u'},
{1,"M_NMARE", M_ChooseSkill, 'n'}
{1,"M_JKILL", M_ChooseSkill, 'i'},
{1,"M_ROUGH", M_ChooseSkill, 'h'},
{1,"M_HURT", M_ChooseSkill, 'h'},
{1,"M_ULTRA", M_ChooseSkill, 'u'},
{1,"M_NMARE", M_ChooseSkill, 'n'}
};
 
menu_t NewDef =
{
newg_end, // # of menu items
&EpiDef, // previous menu
NewGameMenu, // menuitem_t ->
M_DrawNewGame, // drawing routine ->
newg_end, // # of menu items
&EpiDef, // previous menu
NewGameMenu, // menuitem_t ->
M_DrawNewGame, // drawing routine ->
48,63, // x,y
hurtme // lastOn
hurtme // lastOn
};
 
 
346,14 → 346,14
 
menuitem_t OptionsMenu[]=
{
{1,"M_ENDGAM", M_EndGame,'e'},
{1,"M_MESSG", M_ChangeMessages,'m'},
{1,"M_DETAIL", M_ChangeDetail,'g'},
{2,"M_SCRNSZ", M_SizeDisplay,'s'},
{1,"M_ENDGAM", M_EndGame,'e'},
{1,"M_MESSG", M_ChangeMessages,'m'},
{1,"M_DETAIL", M_ChangeDetail,'g'},
{2,"M_SCRNSZ", M_SizeDisplay,'s'},
{-1,"",0},
{2,"M_MSENS", M_ChangeSensitivity,'m'},
{2,"M_MSENS", M_ChangeSensitivity,'m'},
{-1,"",0},
{1,"M_SVOL", M_Sound,'s'}
{1,"M_SVOL", M_Sound,'s'}
};
 
menu_t OptionsDef =
509,21 → 509,21
int count;
int i;
char name[256];
 
for (i = 0;i < load_end;i++)
{
sprintf(name,SAVEGAMENAME"%d.dsg",i);
sprintf(name,"doomsav%d.dsg",i);
 
handle = fopen (name, "r");
if (handle == NULL)
{
strcpy(&savegamestrings[i][0],EMPTYSTRING);
LoadMenu[i].status = 0;
continue;
}
count = fread (&savegamestrings[i], 1, SAVESTRINGSIZE, handle);
fclose (handle);
LoadMenu[i].status = 1;
handle = fopen (name, "r");
if (handle == NULL)
{
strcpy(&savegamestrings[i][0],EMPTYSTRING);
LoadMenu[i].status = 0;
continue;
}
count = fread (&savegamestrings[i], 1, SAVESTRINGSIZE, handle);
fclose (handle);
LoadMenu[i].status = 1;
}
}
 
534,12 → 534,12
void M_DrawLoad(void)
{
int i;
V_DrawPatchDirect (72,28,0,W_CacheLumpName("M_LOADG",PU_CACHE));
for (i = 0;i < load_end; i++)
{
M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i);
M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i]);
M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i);
M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i]);
}
}
 
551,13 → 551,13
void M_DrawSaveLoadBorder(int x,int y)
{
int i;
V_DrawPatchDirect (x-8,y+7,0,W_CacheLumpName("M_LSLEFT",PU_CACHE));
for (i = 0;i < 24;i++)
{
V_DrawPatchDirect (x,y+7,0,W_CacheLumpName("M_LSCNTR",PU_CACHE));
x += 8;
V_DrawPatchDirect (x,y+7,0,W_CacheLumpName("M_LSCNTR",PU_CACHE));
x += 8;
}
 
V_DrawPatchDirect (x,y+7,0,W_CacheLumpName("M_LSRGHT",PU_CACHE));
571,11 → 571,12
void M_LoadSelect(int choice)
{
char name[256];
if (M_CheckParm("-cdrom"))
sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",choice);
else
sprintf(name,SAVEGAMENAME"%d.dsg",choice);
// if (M_CheckParm("-cdrom"))
// sprintf(name,"c:\\doomdata\\doomsav%d.dsg",choice);
// else
sprintf(name,"doomsav%d.dsg",choice);
 
G_LoadGame (name);
M_ClearMenus ();
}
587,10 → 588,10
{
if (netgame)
{
M_StartMessage(LOADNET,NULL,false);
return;
M_StartMessage(LOADNET,NULL,false);
return;
}
M_SetupNextMenu(&LoadDef);
M_ReadSaveStrings();
}
602,18 → 603,18
void M_DrawSave(void)
{
int i;
V_DrawPatchDirect (72,28,0,W_CacheLumpName("M_SAVEG",PU_CACHE));
for (i = 0;i < load_end; i++)
{
M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i);
M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i]);
M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i);
M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i]);
}
if (saveStringEnter)
{
i = M_StringWidth(savegamestrings[saveSlot]);
M_WriteText(LoadDef.x + i,LoadDef.y+LINEHEIGHT*saveSlot,"_");
i = M_StringWidth(savegamestrings[saveSlot]);
M_WriteText(LoadDef.x + i,LoadDef.y+LINEHEIGHT*saveSlot,"_");
}
}
 
622,12 → 623,13
//
void M_DoSave(int slot)
{
 
G_SaveGame (slot,savegamestrings[slot]);
M_ClearMenus ();
 
// PICK QUICKSAVE SLOT YET?
if (quickSaveSlot == -2)
quickSaveSlot = slot;
quickSaveSlot = slot;
}
 
//
641,7 → 643,7
saveSlot = choice;
strcpy(saveOldString,savegamestrings[choice]);
if (!strcmp(savegamestrings[choice],EMPTYSTRING))
savegamestrings[choice][0] = 0;
savegamestrings[choice][0] = 0;
saveCharIndex = strlen(savegamestrings[choice]);
}
 
652,13 → 654,13
{
if (!usergame)
{
M_StartMessage(SAVEDEAD,NULL,false);
return;
M_StartMessage(SAVEDEAD,NULL,false);
return;
}
if (gamestate != GS_LEVEL)
return;
return;
M_SetupNextMenu(&SaveDef);
M_ReadSaveStrings();
}
674,8 → 676,8
{
if (ch == 'y')
{
M_DoSave(quickSaveSlot);
S_StartSound(NULL,sfx_swtchx);
M_DoSave(quickSaveSlot);
S_StartSound(NULL,sfx_swtchx);
}
}
 
683,20 → 685,20
{
if (!usergame)
{
S_StartSound(NULL,sfx_oof);
return;
S_StartSound(NULL,sfx_oof);
return;
}
 
if (gamestate != GS_LEVEL)
return;
return;
if (quickSaveSlot < 0)
{
M_StartControlPanel();
M_ReadSaveStrings();
M_SetupNextMenu(&SaveDef);
quickSaveSlot = -2; // means to pick a slot now
return;
M_StartControlPanel();
M_ReadSaveStrings();
M_SetupNextMenu(&SaveDef);
quickSaveSlot = -2; // means to pick a slot now
return;
}
sprintf(tempstring,QSPROMPT,savegamestrings[quickSaveSlot]);
M_StartMessage(tempstring,M_QuickSaveResponse,true);
711,8 → 713,8
{
if (ch == 'y')
{
M_LoadSelect(quickSaveSlot);
S_StartSound(NULL,sfx_swtchx);
M_LoadSelect(quickSaveSlot);
S_StartSound(NULL,sfx_swtchx);
}
}
 
721,14 → 723,14
{
if (netgame)
{
M_StartMessage(QLOADNET,NULL,false);
return;
M_StartMessage(QLOADNET,NULL,false);
return;
}
if (quickSaveSlot < 0)
{
M_StartMessage(QSAVESPOT,NULL,false);
return;
M_StartMessage(QSAVESPOT,NULL,false);
return;
}
sprintf(tempstring,QLPROMPT,savegamestrings[quickSaveSlot]);
M_StartMessage(tempstring,M_QuickLoadResponse,true);
747,15 → 749,15
switch ( gamemode )
{
case commercial:
V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP",PU_CACHE));
break;
V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP",PU_CACHE));
break;
case shareware:
case registered:
case retail:
V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP1",PU_CACHE));
break;
V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP1",PU_CACHE));
break;
default:
break;
break;
}
return;
}
772,15 → 774,15
{
case retail:
case commercial:
// This hack keeps us from having to change menus.
V_DrawPatchDirect (0,0,0,W_CacheLumpName("CREDIT",PU_CACHE));
break;
// This hack keeps us from having to change menus.
V_DrawPatchDirect (0,0,0,W_CacheLumpName("CREDIT",PU_CACHE));
break;
case shareware:
case registered:
V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP2",PU_CACHE));
break;
V_DrawPatchDirect (0,0,0,W_CacheLumpName("HELP2",PU_CACHE));
break;
default:
break;
break;
}
return;
}
794,10 → 796,10
V_DrawPatchDirect (60,38,0,W_CacheLumpName("M_SVOL",PU_CACHE));
 
M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(sfx_vol+1),
16,snd_SfxVolume);
16,snd_SfxVolume);
 
M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(music_vol+1),
16,snd_MusicVolume);
16,snd_MusicVolume);
}
 
void M_Sound(int choice)
810,15 → 812,15
switch(choice)
{
case 0:
if (snd_SfxVolume)
snd_SfxVolume--;
break;
if (snd_SfxVolume)
snd_SfxVolume--;
break;
case 1:
if (snd_SfxVolume < 15)
snd_SfxVolume++;
break;
if (snd_SfxVolume < 15)
snd_SfxVolume++;
break;
}
S_SetSfxVolume(snd_SfxVolume /* *8 */);
}
 
827,15 → 829,15
switch(choice)
{
case 0:
if (snd_MusicVolume)
snd_MusicVolume--;
break;
if (snd_MusicVolume)
snd_MusicVolume--;
break;
case 1:
if (snd_MusicVolume < 15)
snd_MusicVolume++;
break;
if (snd_MusicVolume < 15)
snd_MusicVolume++;
break;
}
S_SetMusicVolume(snd_MusicVolume /* *8 */);
}
 
866,14 → 868,14
{
if (netgame && !demoplayback)
{
M_StartMessage(NEWGAME,NULL,false);
return;
M_StartMessage(NEWGAME,NULL,false);
return;
}
if ( gamemode == commercial )
M_SetupNextMenu(&NewDef);
M_SetupNextMenu(&NewDef);
else
M_SetupNextMenu(&EpiDef);
M_SetupNextMenu(&EpiDef);
}
 
 
890,8 → 892,8
void M_VerifyNightmare(int ch)
{
if (ch != 'y')
return;
return;
G_DeferedInitNew(nightmare,epi+1,1);
M_ClearMenus ();
}
900,10 → 902,10
{
if (choice == nightmare)
{
M_StartMessage(NIGHTMARE,M_VerifyNightmare,true);
return;
M_StartMessage(NIGHTMARE,M_VerifyNightmare,true);
return;
}
G_DeferedInitNew(choice,epi+1,1);
M_ClearMenus ();
}
911,21 → 913,21
void M_Episode(int choice)
{
if ( (gamemode == shareware)
&& choice)
&& choice)
{
M_StartMessage(SWSTRING,NULL,false);
M_SetupNextMenu(&ReadDef1);
return;
M_StartMessage(SWSTRING,NULL,false);
M_SetupNextMenu(&ReadDef1);
return;
}
 
// Yet another hack...
if ( (gamemode == registered)
&& (choice > 2))
&& (choice > 2))
{
// __libclog_printf("M_Episode: 4th episode requires UltimateDOOM\n");
choice = 0;
}
epi = choice;
M_SetupNextMenu(&NewDef);
}
935,25 → 937,25
//
// M_Options
//
char detailNames[2][9] = {"M_GDHIGH","M_GDLOW"};
char msgNames[2][9] = {"M_MSGOFF","M_MSGON"};
char detailNames[2][9] = {"M_GDHIGH","M_GDLOW"};
char msgNames[2][9] = {"M_MSGOFF","M_MSGON"};
 
 
void M_DrawOptions(void)
{
V_DrawPatchDirect (108,15,0,W_CacheLumpName("M_OPTTTL",PU_CACHE));
V_DrawPatchDirect (OptionsDef.x + 175,OptionsDef.y+LINEHEIGHT*detail,0,
W_CacheLumpName(detailNames[detailLevel],PU_CACHE));
W_CacheLumpName(detailNames[detailLevel],PU_CACHE));
 
V_DrawPatchDirect (OptionsDef.x + 120,OptionsDef.y+LINEHEIGHT*messages,0,
W_CacheLumpName(msgNames[showMessages],PU_CACHE));
W_CacheLumpName(msgNames[showMessages],PU_CACHE));
 
M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(mousesens+1),
10,mouseSensitivity);
10,mouseSensitivity);
M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(scrnsize+1),
9,screenSize);
9,screenSize);
}
 
void M_Options(int choice)
971,11 → 973,11
// warning: unused parameter `int choice'
choice = 0;
showMessages = 1 - showMessages;
if (!showMessages)
players[consoleplayer].message = MSGOFF;
players[consoleplayer].message = MSGOFF;
else
players[consoleplayer].message = MSGON ;
players[consoleplayer].message = MSGON ;
 
message_dontfuckwithme = true;
}
987,8 → 989,8
void M_EndGameResponse(int ch)
{
if (ch != 'y')
return;
return;
currentMenu->lastOn = itemOn;
M_ClearMenus ();
D_StartTitle ();
999,16 → 1001,16
choice = 0;
if (!usergame)
{
S_StartSound(NULL,sfx_oof);
return;
S_StartSound(NULL,sfx_oof);
return;
}
if (netgame)
{
M_StartMessage(NETEND,NULL,false);
return;
M_StartMessage(NETEND,NULL,false);
return;
}
M_StartMessage(ENDGAME,M_EndGameResponse,true);
}
 
1071,14 → 1073,14
void M_QuitResponse(int ch)
{
if (ch != 'y')
return;
return;
if (!netgame)
{
if (gamemode == commercial)
S_StartSound(NULL,quitsounds2[(gametic>>2)&7]);
else
S_StartSound(NULL,quitsounds[(gametic>>2)&7]);
I_WaitVBL(105);
if (gamemode == commercial)
S_StartSound(NULL,quitsounds2[(gametic>>2)&7]);
else
S_StartSound(NULL,quitsounds[(gametic>>2)&7]);
I_WaitVBL(105);
}
I_Quit ();
}
1105,13 → 1107,13
switch(choice)
{
case 0:
if (mouseSensitivity)
mouseSensitivity--;
break;
if (mouseSensitivity)
mouseSensitivity--;
break;
case 1:
if (mouseSensitivity < 9)
mouseSensitivity++;
break;
if (mouseSensitivity < 9)
mouseSensitivity++;
break;
}
}
 
1131,9 → 1133,9
/*R_SetViewSize (screenblocks, detailLevel);
 
if (!detailLevel)
players[consoleplayer].message = DETAILHI;
players[consoleplayer].message = DETAILHI;
else
players[consoleplayer].message = DETAILLO;*/
players[consoleplayer].message = DETAILLO;*/
}
 
 
1144,21 → 1146,21
switch(choice)
{
case 0:
if (screenSize > 0)
{
screenblocks--;
screenSize--;
}
break;
if (screenSize > 0)
{
screenblocks--;
screenSize--;
}
break;
case 1:
if (screenSize < 8)
{
screenblocks++;
screenSize++;
}
break;
if (screenSize < 8)
{
screenblocks++;
screenSize++;
}
break;
}
 
R_SetViewSize (screenblocks, detailLevel);
}
1171,13 → 1173,13
//
void
M_DrawThermo
( int x,
int y,
int thermWidth,
int thermDot )
( int x,
int y,
int thermWidth,
int thermDot )
{
int xx;
int i;
int xx;
int i;
 
xx = x;
V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERML",PU_CACHE));
1184,13 → 1186,13
xx += 8;
for (i=0;i<thermWidth;i++)
{
V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERMM",PU_CACHE));
xx += 8;
V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERMM",PU_CACHE));
xx += 8;
}
V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERMR",PU_CACHE));
 
V_DrawPatchDirect ((x+8) + thermDot*8,y,
0,W_CacheLumpName("M_THERMO",PU_CACHE));
0,W_CacheLumpName("M_THERMO",PU_CACHE));
}
 
 
1197,28 → 1199,28
 
void
M_DrawEmptyCell
( menu_t* menu,
int item )
( menu_t* menu,
int item )
{
V_DrawPatchDirect (menu->x - 10, menu->y+item*LINEHEIGHT - 1, 0,
W_CacheLumpName("M_CELL1",PU_CACHE));
W_CacheLumpName("M_CELL1",PU_CACHE));
}
 
void
M_DrawSelCell
( menu_t* menu,
int item )
( menu_t* menu,
int item )
{
V_DrawPatchDirect (menu->x - 10, menu->y+item*LINEHEIGHT - 1, 0,
W_CacheLumpName("M_CELL2",PU_CACHE));
W_CacheLumpName("M_CELL2",PU_CACHE));
}
 
 
void
M_StartMessage
( char* string,
void* routine,
boolean input )
( char* string,
void* routine,
boolean input )
{
messageLastMenuActive = menuactive;
messageToPrint = 1;
1247,16 → 1249,16
int i;
int w = 0;
int c;
for (i = 0;i < strlen(string);i++)
{
c = toupper(string[i]) - HU_FONTSTART;
if (c < 0 || c >= HU_FONTSIZE)
w += 4;
else
w += SHORT (hu_font[c]->width);
c = toupper(string[i]) - HU_FONTSTART;
if (c < 0 || c >= HU_FONTSIZE)
w += 4;
else
w += SHORT (hu_font[c]->width);
}
return w;
}
 
1270,12 → 1272,12
int i;
int h;
int height = SHORT(hu_font[0]->height);
h = height;
for (i = 0;i < strlen(string);i++)
if (string[i] == '\n')
h += height;
if (string[i] == '\n')
h += height;
return h;
}
 
1285,45 → 1287,45
//
void
M_WriteText
( int x,
int y,
char* string)
( int x,
int y,
char* string)
{
int w;
char* ch;
int c;
int cx;
int cy;
int w;
char* ch;
int c;
int cx;
int cy;
 
ch = string;
cx = x;
cy = y;
while(1)
{
c = *ch++;
if (!c)
break;
if (c == '\n')
{
cx = x;
cy += 12;
continue;
}
c = toupper(c) - HU_FONTSTART;
if (c < 0 || c>= HU_FONTSIZE)
{
cx += 4;
continue;
}
w = SHORT (hu_font[c]->width);
if (cx+w > SCREENWIDTH)
break;
V_DrawPatchDirect(cx, cy, 0, hu_font[c]);
cx+=w;
c = *ch++;
if (!c)
break;
if (c == '\n')
{
cx = x;
cy += 12;
continue;
}
c = toupper(c) - HU_FONTSTART;
if (c < 0 || c>= HU_FONTSIZE)
{
cx += 4;
continue;
}
w = SHORT (hu_font[c]->width);
if (cx+w > SCREENWIDTH)
break;
V_DrawPatchDirect(cx, cy, 0, hu_font[c]);
cx+=w;
}
}
 
1346,265 → 1348,265
static int lasty = 0;
static int mousex = 0;
static int lastx = 0;
ch = -1;
if (ev->type == ev_joystick && joywait < I_GetTime())
{
if (ev->data3 == -1)
{
ch = KEY_UPARROW;
joywait = I_GetTime() + 5;
}
else if (ev->data3 == 1)
{
ch = KEY_DOWNARROW;
joywait = I_GetTime() + 5;
}
if (ev->data2 == -1)
{
ch = KEY_LEFTARROW;
joywait = I_GetTime() + 2;
}
else if (ev->data2 == 1)
{
ch = KEY_RIGHTARROW;
joywait = I_GetTime() + 2;
}
if (ev->data1&1)
{
ch = KEY_ENTER;
joywait = I_GetTime() + 5;
}
if (ev->data1&2)
{
ch = KEY_BACKSPACE;
joywait = I_GetTime() + 5;
}
if (ev->data3 == -1)
{
ch = KEY_UPARROW;
joywait = I_GetTime() + 5;
}
else if (ev->data3 == 1)
{
ch = KEY_DOWNARROW;
joywait = I_GetTime() + 5;
}
if (ev->data2 == -1)
{
ch = KEY_LEFTARROW;
joywait = I_GetTime() + 2;
}
else if (ev->data2 == 1)
{
ch = KEY_RIGHTARROW;
joywait = I_GetTime() + 2;
}
if (ev->data1&1)
{
ch = KEY_ENTER;
joywait = I_GetTime() + 5;
}
if (ev->data1&2)
{
ch = KEY_BACKSPACE;
joywait = I_GetTime() + 5;
}
}
else
{
if (ev->type == ev_mouse && mousewait < I_GetTime())
{
mousey += ev->data3;
if (mousey < lasty-30)
{
ch = KEY_DOWNARROW;
mousewait = I_GetTime() + 5;
mousey = lasty -= 30;
}
else if (mousey > lasty+30)
{
ch = KEY_UPARROW;
mousewait = I_GetTime() + 5;
mousey = lasty += 30;
}
mousex += ev->data2;
if (mousex < lastx-30)
{
ch = KEY_LEFTARROW;
mousewait = I_GetTime() + 5;
mousex = lastx -= 30;
}
else if (mousex > lastx+30)
{
ch = KEY_RIGHTARROW;
mousewait = I_GetTime() + 5;
mousex = lastx += 30;
}
if (ev->data1&1)
{
ch = KEY_ENTER;
mousewait = I_GetTime() + 15;
}
if (ev->data1&2)
{
ch = KEY_BACKSPACE;
mousewait = I_GetTime() + 15;
}
}
else
if (ev->type == ev_keydown)
{
ch = ev->data1;
}
if (ev->type == ev_mouse && mousewait < I_GetTime())
{
mousey += ev->data3;
if (mousey < lasty-30)
{
ch = KEY_DOWNARROW;
mousewait = I_GetTime() + 5;
mousey = lasty -= 30;
}
else if (mousey > lasty+30)
{
ch = KEY_UPARROW;
mousewait = I_GetTime() + 5;
mousey = lasty += 30;
}
mousex += ev->data2;
if (mousex < lastx-30)
{
ch = KEY_LEFTARROW;
mousewait = I_GetTime() + 5;
mousex = lastx -= 30;
}
else if (mousex > lastx+30)
{
ch = KEY_RIGHTARROW;
mousewait = I_GetTime() + 5;
mousex = lastx += 30;
}
if (ev->data1&1)
{
ch = KEY_ENTER;
mousewait = I_GetTime() + 15;
}
if (ev->data1&2)
{
ch = KEY_BACKSPACE;
mousewait = I_GetTime() + 15;
}
}
else
if (ev->type == ev_keydown)
{
ch = ev->data1;
}
}
if (ch == -1)
return false;
return false;
 
// Save Game string input
if (saveStringEnter)
{
switch(ch)
{
case KEY_BACKSPACE:
if (saveCharIndex > 0)
{
saveCharIndex--;
savegamestrings[saveSlot][saveCharIndex] = 0;
}
break;
case KEY_ESCAPE:
saveStringEnter = 0;
strcpy(&savegamestrings[saveSlot][0],saveOldString);
break;
case KEY_ENTER:
saveStringEnter = 0;
if (savegamestrings[saveSlot][0])
M_DoSave(saveSlot);
break;
default:
ch = toupper(ch);
if (ch != 32)
if (ch-HU_FONTSTART < 0 || ch-HU_FONTSTART >= HU_FONTSIZE)
break;
if (ch >= 32 && ch <= 127 &&
saveCharIndex < SAVESTRINGSIZE-1 &&
M_StringWidth(savegamestrings[saveSlot]) <
(SAVESTRINGSIZE-2)*8)
{
savegamestrings[saveSlot][saveCharIndex++] = ch;
savegamestrings[saveSlot][saveCharIndex] = 0;
}
break;
}
return true;
switch(ch)
{
case KEY_BACKSPACE:
if (saveCharIndex > 0)
{
saveCharIndex--;
savegamestrings[saveSlot][saveCharIndex] = 0;
}
break;
case KEY_ESCAPE:
saveStringEnter = 0;
strcpy(&savegamestrings[saveSlot][0],saveOldString);
break;
case KEY_ENTER:
saveStringEnter = 0;
if (savegamestrings[saveSlot][0])
M_DoSave(saveSlot);
break;
default:
ch = toupper(ch);
if (ch != 32)
if (ch-HU_FONTSTART < 0 || ch-HU_FONTSTART >= HU_FONTSIZE)
break;
if (ch >= 32 && ch <= 127 &&
saveCharIndex < SAVESTRINGSIZE-1 &&
M_StringWidth(savegamestrings[saveSlot]) <
(SAVESTRINGSIZE-2)*8)
{
savegamestrings[saveSlot][saveCharIndex++] = ch;
savegamestrings[saveSlot][saveCharIndex] = 0;
}
break;
}
return true;
}
// Take care of any messages that need input
if (messageToPrint)
{
if (messageNeedsInput == true &&
!(ch == ' ' || ch == 'n' || ch == 'y' || ch == KEY_ESCAPE))
return false;
menuactive = messageLastMenuActive;
messageToPrint = 0;
if (messageRoutine)
messageRoutine(ch);
menuactive = false;
S_StartSound(NULL,sfx_swtchx);
return true;
if (messageNeedsInput == true &&
!(ch == ' ' || ch == 'n' || ch == 'y' || ch == KEY_ESCAPE))
return false;
menuactive = messageLastMenuActive;
messageToPrint = 0;
if (messageRoutine)
messageRoutine(ch);
menuactive = false;
S_StartSound(NULL,sfx_swtchx);
return true;
}
if (devparm && ch == KEY_F1)
{
G_ScreenShot ();
return true;
G_ScreenShot ();
return true;
}
// F-Keys
if (!menuactive)
switch(ch)
{
case KEY_MINUS: // Screen size down
if (automapactive || chat_on)
return false;
M_SizeDisplay(0);
S_StartSound(NULL,sfx_stnmov);
return true;
case KEY_EQUALS: // Screen size up
if (automapactive || chat_on)
return false;
M_SizeDisplay(1);
S_StartSound(NULL,sfx_stnmov);
return true;
case KEY_F1: // Help key
M_StartControlPanel ();
switch(ch)
{
case KEY_MINUS: // Screen size down
if (automapactive || chat_on)
return false;
M_SizeDisplay(0);
S_StartSound(NULL,sfx_stnmov);
return true;
case KEY_EQUALS: // Screen size up
if (automapactive || chat_on)
return false;
M_SizeDisplay(1);
S_StartSound(NULL,sfx_stnmov);
return true;
case KEY_F1: // Help key
M_StartControlPanel ();
 
if ( gamemode == retail )
currentMenu = &ReadDef2;
else
currentMenu = &ReadDef1;
itemOn = 0;
S_StartSound(NULL,sfx_swtchn);
return true;
case KEY_F2: // Save
M_StartControlPanel();
S_StartSound(NULL,sfx_swtchn);
M_SaveGame(0);
return true;
case KEY_F3: // Load
M_StartControlPanel();
S_StartSound(NULL,sfx_swtchn);
M_LoadGame(0);
return true;
case KEY_F4: // Sound Volume
M_StartControlPanel ();
currentMenu = &SoundDef;
itemOn = sfx_vol;
S_StartSound(NULL,sfx_swtchn);
return true;
case KEY_F5: // Detail toggle
M_ChangeDetail(0);
S_StartSound(NULL,sfx_swtchn);
return true;
case KEY_F6: // Quicksave
S_StartSound(NULL,sfx_swtchn);
M_QuickSave();
return true;
case KEY_F7: // End game
S_StartSound(NULL,sfx_swtchn);
M_EndGame(0);
return true;
case KEY_F8: // Toggle messages
M_ChangeMessages(0);
S_StartSound(NULL,sfx_swtchn);
return true;
case KEY_F9: // Quickload
S_StartSound(NULL,sfx_swtchn);
M_QuickLoad();
return true;
case KEY_F10: // Quit DOOM
S_StartSound(NULL,sfx_swtchn);
M_QuitDOOM(0);
return true;
case KEY_F11: // gamma toggle
usegamma++;
if (usegamma > 4)
usegamma = 0;
players[consoleplayer].message = gammamsg[usegamma];
I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
return true;
}
if ( gamemode == retail )
currentMenu = &ReadDef2;
else
currentMenu = &ReadDef1;
itemOn = 0;
S_StartSound(NULL,sfx_swtchn);
return true;
case KEY_F2: // Save
M_StartControlPanel();
S_StartSound(NULL,sfx_swtchn);
M_SaveGame(0);
return true;
case KEY_F3: // Load
M_StartControlPanel();
S_StartSound(NULL,sfx_swtchn);
M_LoadGame(0);
return true;
case KEY_F4: // Sound Volume
M_StartControlPanel ();
currentMenu = &SoundDef;
itemOn = sfx_vol;
S_StartSound(NULL,sfx_swtchn);
return true;
case KEY_F5: // Detail toggle
M_ChangeDetail(0);
S_StartSound(NULL,sfx_swtchn);
return true;
case KEY_F6: // Quicksave
S_StartSound(NULL,sfx_swtchn);
M_QuickSave();
return true;
case KEY_F7: // End game
S_StartSound(NULL,sfx_swtchn);
M_EndGame(0);
return true;
case KEY_F8: // Toggle messages
M_ChangeMessages(0);
S_StartSound(NULL,sfx_swtchn);
return true;
case KEY_F9: // Quickload
S_StartSound(NULL,sfx_swtchn);
M_QuickLoad();
return true;
case KEY_F10: // Quit DOOM
S_StartSound(NULL,sfx_swtchn);
M_QuitDOOM(0);
return true;
case KEY_F11: // gamma toggle
usegamma++;
if (usegamma > 4)
usegamma = 0;
players[consoleplayer].message = gammamsg[usegamma];
I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
return true;
}
 
// Pop-up menu?
if (!menuactive)
{
if (ch == KEY_ESCAPE)
{
M_StartControlPanel ();
S_StartSound(NULL,sfx_swtchn);
return true;
}
return false;
if (ch == KEY_ESCAPE)
{
M_StartControlPanel ();
S_StartSound(NULL,sfx_swtchn);
return true;
}
return false;
}
 
1612,94 → 1614,94
switch (ch)
{
case KEY_DOWNARROW:
do
{
if (itemOn+1 > currentMenu->numitems-1)
itemOn = 0;
else itemOn++;
S_StartSound(NULL,sfx_pstop);
} while(currentMenu->menuitems[itemOn].status==-1);
return true;
do
{
if (itemOn+1 > currentMenu->numitems-1)
itemOn = 0;
else itemOn++;
S_StartSound(NULL,sfx_pstop);
} while(currentMenu->menuitems[itemOn].status==-1);
return true;
case KEY_UPARROW:
do
{
if (!itemOn)
itemOn = currentMenu->numitems-1;
else itemOn--;
S_StartSound(NULL,sfx_pstop);
} while(currentMenu->menuitems[itemOn].status==-1);
return true;
do
{
if (!itemOn)
itemOn = currentMenu->numitems-1;
else itemOn--;
S_StartSound(NULL,sfx_pstop);
} while(currentMenu->menuitems[itemOn].status==-1);
return true;
 
case KEY_LEFTARROW:
if (currentMenu->menuitems[itemOn].routine &&
currentMenu->menuitems[itemOn].status == 2)
{
S_StartSound(NULL,sfx_stnmov);
currentMenu->menuitems[itemOn].routine(0);
}
return true;
if (currentMenu->menuitems[itemOn].routine &&
currentMenu->menuitems[itemOn].status == 2)
{
S_StartSound(NULL,sfx_stnmov);
currentMenu->menuitems[itemOn].routine(0);
}
return true;
case KEY_RIGHTARROW:
if (currentMenu->menuitems[itemOn].routine &&
currentMenu->menuitems[itemOn].status == 2)
{
S_StartSound(NULL,sfx_stnmov);
currentMenu->menuitems[itemOn].routine(1);
}
return true;
if (currentMenu->menuitems[itemOn].routine &&
currentMenu->menuitems[itemOn].status == 2)
{
S_StartSound(NULL,sfx_stnmov);
currentMenu->menuitems[itemOn].routine(1);
}
return true;
 
case KEY_ENTER:
if (currentMenu->menuitems[itemOn].routine &&
currentMenu->menuitems[itemOn].status)
{
currentMenu->lastOn = itemOn;
if (currentMenu->menuitems[itemOn].status == 2)
{
currentMenu->menuitems[itemOn].routine(1); // right arrow
S_StartSound(NULL,sfx_stnmov);
}
else
{
currentMenu->menuitems[itemOn].routine(itemOn);
S_StartSound(NULL,sfx_pistol);
}
}
return true;
if (currentMenu->menuitems[itemOn].routine &&
currentMenu->menuitems[itemOn].status)
{
currentMenu->lastOn = itemOn;
if (currentMenu->menuitems[itemOn].status == 2)
{
currentMenu->menuitems[itemOn].routine(1); // right arrow
S_StartSound(NULL,sfx_stnmov);
}
else
{
currentMenu->menuitems[itemOn].routine(itemOn);
S_StartSound(NULL,sfx_pistol);
}
}
return true;
case KEY_ESCAPE:
currentMenu->lastOn = itemOn;
M_ClearMenus ();
S_StartSound(NULL,sfx_swtchx);
return true;
currentMenu->lastOn = itemOn;
M_ClearMenus ();
S_StartSound(NULL,sfx_swtchx);
return true;
case KEY_BACKSPACE:
currentMenu->lastOn = itemOn;
if (currentMenu->prevMenu)
{
currentMenu = currentMenu->prevMenu;
itemOn = currentMenu->lastOn;
S_StartSound(NULL,sfx_swtchn);
}
return true;
currentMenu->lastOn = itemOn;
if (currentMenu->prevMenu)
{
currentMenu = currentMenu->prevMenu;
itemOn = currentMenu->lastOn;
S_StartSound(NULL,sfx_swtchn);
}
return true;
default:
for (i = itemOn+1;i < currentMenu->numitems;i++)
if (currentMenu->menuitems[i].alphaKey == ch)
{
itemOn = i;
S_StartSound(NULL,sfx_pstop);
return true;
}
for (i = 0;i <= itemOn;i++)
if (currentMenu->menuitems[i].alphaKey == ch)
{
itemOn = i;
S_StartSound(NULL,sfx_pstop);
return true;
}
break;
for (i = itemOn+1;i < currentMenu->numitems;i++)
if (currentMenu->menuitems[i].alphaKey == ch)
{
itemOn = i;
S_StartSound(NULL,sfx_pstop);
return true;
}
for (i = 0;i <= itemOn;i++)
if (currentMenu->menuitems[i].alphaKey == ch)
{
itemOn = i;
S_StartSound(NULL,sfx_pstop);
return true;
}
break;
}
 
return false;
1714,7 → 1716,7
{
// intro might call this repeatedly
if (menuactive)
return;
return;
menuactive = 1;
currentMenu = &MainDef; // JDC
1729,14 → 1731,14
//
void M_Drawer (void)
{
static short x;
static short y;
short i;
short max;
static short x;
static short y;
short i;
short max;
char *p;
int len;
char string[40];
int start;
char string[40];
int start;
 
inhelpscreens = false;
 
1743,22 → 1745,22
// Horiz. & Vertically center string and print it.
if (messageToPrint)
{
y = 100 - M_StringHeight(messageString)/2;
p = messageString;
len = strlen(p);
while(*p)
{
y = 100 - M_StringHeight(messageString)/2;
p = messageString;
len = strlen(p);
while(*p)
{
for (i = 0;len;i++,len--)
{
if (*(p+i) == '\n')
{ memset(string,0,40);
strncpy(string,p,i);
p+= i+1;
len-= 1;
break;
};
};
if (*(p+i) == '\n')
{ memset(string,0,40);
strncpy(string,p,i);
p+= i+1;
len-= 1;
break;
};
};
if (len == 0)
{ strncpy(string,p,i);
p+=i;
1766,15 → 1768,15
x = 160 - M_StringWidth(string)/2;
M_WriteText(x,y,string);
y += SHORT(hu_font[0]->height);
};
return;
};
return;
};
 
if (!menuactive)
return;
return;
 
if (currentMenu->routine)
currentMenu->routine(); // call Draw routine
currentMenu->routine(); // call Draw routine
// DRAW MENU
x = currentMenu->x;
1783,16 → 1785,16
 
for (i=0;i<max;i++)
{
if (currentMenu->menuitems[i].name[0])
V_DrawPatchDirect (x,y,0,
W_CacheLumpName(currentMenu->menuitems[i].name ,PU_CACHE));
y += LINEHEIGHT;
if (currentMenu->menuitems[i].name[0])
V_DrawPatchDirect (x,y,0,
W_CacheLumpName(currentMenu->menuitems[i].name ,PU_CACHE));
y += LINEHEIGHT;
}
 
// DRAW SKULL
V_DrawPatchDirect(x + SKULLXOFF,currentMenu->y - 5 + itemOn*LINEHEIGHT, 0,
W_CacheLumpName(skullName[whichSkull],PU_CACHE));
W_CacheLumpName(skullName[whichSkull],PU_CACHE));
 
}
 
1827,8 → 1829,8
{
if (--skullAnimCounter <= 0)
{
whichSkull ^= 1;
skullAnimCounter = 8;
whichSkull ^= 1;
skullAnimCounter = 8;
}
}
 
1856,29 → 1858,29
switch ( gamemode )
{
case commercial:
// This is used because DOOM 2 had only one HELP
// This is used because DOOM 2 had only one HELP
// page. I use CREDIT as second page now, but
// kept this hack for educational purposes.
MainMenu[readthis] = MainMenu[quitdoom];
MainDef.numitems--;
MainDef.y += 8;
NewDef.prevMenu = &MainDef;
ReadDef1.routine = M_DrawReadThis1;
ReadDef1.x = 330;
ReadDef1.y = 165;
ReadMenu1[0].routine = M_FinishReadThis;
break;
// kept this hack for educational purposes.
MainMenu[readthis] = MainMenu[quitdoom];
MainDef.numitems--;
MainDef.y += 8;
NewDef.prevMenu = &MainDef;
ReadDef1.routine = M_DrawReadThis1;
ReadDef1.x = 330;
ReadDef1.y = 165;
ReadMenu1[0].routine = M_FinishReadThis;
break;
case shareware:
// Episode 2 and 3 are handled,
// branching to an ad screen.
// Episode 2 and 3 are handled,
// branching to an ad screen.
case registered:
// We need to remove the fourth episode.
EpiDef.numitems--;
break;
// We need to remove the fourth episode.
EpiDef.numitems--;
break;
case retail:
// We are fine.
// We are fine.
default:
break;
break;
}
}
/programs/games/doom/trunk/m_misc.c
29,7 → 29,6
 
#include <stdlib.h>
#include <ctype.h>
//#include "//kolibc.h"
 
//extern int access(char *file, int mode);
 
106,6 → 105,8
#define O_BINARY 0
#endif
 
int write_once(const char *name, void *buffer, unsigned len);
 
boolean
M_WriteFile
( char const* name,
112,16 → 113,21
void* source,
int length )
{
FILE *handle;
// FILE *handle;
int count;
handle = fopen ( name, "wb");
// handle = fopen ( name, "wb");
 
if (handle == NULL)
return false;
// if (handle == NULL)
// return false;
 
// count = fwrite (source, 1, length, handle);
fclose (handle);
// printf("writeFile %s, &s, %d \n\r", name, source, length);
count = write_once(name, source, length);
// printf("%d \n\r", count);
// count = fwrite (source, 1, length, handle);
// fclose (handle);
if (count < length)
return false;
/programs/games/doom/trunk/s_sound.c
256,11 → 256,23
};
}
 
if(ver< SOUND_VERSION)
 
if( SOUND_VERSION>(ver&0xFFFF))
{
printf("Sound version mismatch\n\r");
printf("Current version: %d, required version %d\n\r",
ver&0xFFFF, SOUND_VERSION);
_asm
{
mov eax, -1
int 0x40
};
};
if(SOUND_VERSION<(ver >> 16))
{
printf("Sound service version mismatch\n\r");
printf("Installed version: %d, required version %d\n\r",
printf("Sound version obsolete\n\r");
printf("Compatible version: %d, required version %d\n\r",
ver, SOUND_VERSION);
_asm
{
/programs/games/doom/trunk/system/include/kolibri.h
0,0 → 1,106
 
#ifdef __cplusplus
extern "C"
{
#endif
 
 
#define FONT0 0x00000000
#define FONT1 0x10000000
 
#define BT_NORMAL 0x00000000
#define BT_NOFRAME 0x20000000
#define BT_HIDE 0x40000000
#define BT_DEL 0x80000000
 
#define EV_REDRAW 1
#define EV_KEY 2
#define EV_BUTTON 3
 
#define REL_SCREEN 0
#define REL_WINDOW 1
 
#define FILE_NOT_FOUND 5
#define FILE_EOF 6
 
 
typedef unsigned int DWORD;
typedef unsigned short int WORD;
 
typedef struct
{ DWORD pci_cmd;
DWORD irq;
DWORD glob_cntrl;
DWORD glob_sta;
DWORD codec_io_base;
DWORD ctrl_io_base;
DWORD codec_mem_base;
DWORD ctrl_mem_base;
DWORD codec_id;
} CTRL_INFO;
 
typedef struct
{ DWORD cmd;
DWORD offset;
DWORD r1;
DWORD count;
DWORD buff;
char r2;
char *name;
} FILEIO;
 
typedef struct
{ DWORD attr;
DWORD flags;
DWORD cr_time;
DWORD cr_date;
DWORD acc_time;
DWORD acc_date;
DWORD mod_time;
DWORD mod_date;
DWORD size;
DWORD size_high;
} FILEINFO;
 
void _stdcall InitHeap(int heap_size);
void* _stdcall UserAlloc(int size);
int _stdcall UserFree(void* p);
void _stdcall GetNotify(void *event);
 
void _stdcall CreateThread(void *fn, char *p_stack);
 
DWORD _stdcall GetMousePos(DWORD rel_type);
 
void _stdcall debug_out_hex(DWORD val);
void debug_out_str(char* str);
 
int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
int _stdcall create_file(const char *name);
int _stdcall read_file (const char *name,char*buff,DWORD offset,DWORD count,DWORD *reads);
int _stdcall write_file(const char *name,const void *buff,DWORD offset,DWORD count,DWORD *writes);
 
//void exit();
int _stdcall get_key(int *key);
int _stdcall remap_key(int key);
 
int _cdecl get_button_id();
 
void delay(int val);
int wait_for_event(int time);
int wait_for_event_infinite();
void BeginDraw(void);
void EndDraw(void);
 
void _stdcall GetScreenSize(int *x, int*y);
void _stdcall DrawWindow(int x,int y, int sx, int sy,int workcolor,int style,
int captioncolor,int windowtype,int bordercolor);
void _stdcall debug_out(int ch);
void _stdcall make_button(int x, int y, int xsize, int ysize, int id, int color);
void _stdcall draw_bar(int x, int y, int xsize, int ysize, int color);
void _stdcall write_text(int x,int y,int color,char* text,int len);
 
#ifdef __cplusplus
extern "C"
}
#endif
/programs/games/doom/trunk/system/include/sound.h
0,0 → 1,133
 
#ifndef _SOUND_H_
#define _SOUND_H_
 
#ifdef __cplusplus
extern "C"
{
#endif
 
#define SOUND_VERSION 0x0100
#define PCM_ALL 0
 
#define PCM_OUT 0x08000000
#define PCM_RING 0x10000000
#define PCM_STATIC 0x20000000
#define PCM_FLOAT 0x40000000
#define PCM_FILTER 0x80000000
 
#define PCM_2_16_48 1
#define PCM_1_16_48 2
#define PCM_2_16_44 3
#define PCM_1_16_44 4
#define PCM_2_16_32 5
#define PCM_1_16_32 6
#define PCM_2_16_24 7
#define PCM_1_16_24 8
#define PCM_2_16_22 9
#define PCM_1_16_22 10
#define PCM_2_16_16 11
#define PCM_1_16_16 12
#define PCM_2_16_12 13
#define PCM_1_16_12 14
#define PCM_2_16_11 15
#define PCM_1_16_11 16
#define PCM_2_16_8 17
#define PCM_1_16_8 18
#define PCM_2_8_48 19
#define PCM_1_8_48 20
#define PCM_2_8_44 21
#define PCM_1_8_44 22
#define PCM_2_8_32 23
#define PCM_1_8_32 24
#define PCM_2_8_24 25
#define PCM_1_8_24 26
#define PCM_2_8_22 27
#define PCM_1_8_22 28
#define PCM_2_8_16 29
#define PCM_1_8_16 30
#define PCM_2_8_12 31
#define PCM_1_8_12 32
#define PCM_2_8_11 33
#define PCM_1_8_11 34
#define PCM_2_8_8 35
#define PCM_1_8_8 36
 
#define SRV_GETVERSION 0
#define SND_CREATE_BUFF 1
#define SND_DESTROY_BUFF 2
#define SND_SETFORMAT 3
#define SND_GETFORMAT 4
#define SND_RESET 5
#define SND_SETPOS 6
#define SND_GETPOS 7
#define SND_SETBUFF 8
#define SND_OUT 9
#define SND_PLAY 10
#define SND_STOP 11
#define SND_SETVOLUME 12
#define SND_GETVOLUME 13
#define SND_SETPAN 14
#define SND_GETPAN 15
#define SND_GETBUFFSIZE 16
 
#define PLAY_SYNC 0x80000000
 
typedef unsigned int SNDBUF;
 
int _stdcall InitSound(int *version);
 
int _stdcall CreateBuffer(unsigned int format,int size,SNDBUF *buf);
int _stdcall DestroyBuffer(SNDBUF hBuff);
 
int _stdcall SetFormat(SNDBUF hBuff, unsigned int format);
int _stdcall GetFormat(SNDBUF hBuff, unsigned int *format);
 
int _stdcall ResetBuffer(SNDBUF hBuff, unsigned int flags);
int _stdcall SetBufferPos(SNDBUF hBuff, int offset);
int _stdcall GetBufferPos(SNDBUF hBuff, int *offset);
int _stdcall GetBufferSize(SNDBUF hBuff, int *size);
 
int _stdcall SetBuffer(SNDBUF hBuff,void* buff,
int offs, int size);
int _stdcall WaveOut(SNDBUF hBuff,void *buff, int size);
int _stdcall PlayBuffer(SNDBUF hBuff,unsigned int flags);
int _stdcall StopBuffer(SNDBUF hBuff);
 
int _stdcall SetVolume(SNDBUF hBuff, int left, int right);
int _stdcall GetVolume(SNDBUF hBuff, int *left, int *right);
int _stdcall SetPan(SNDBUF hBuff, int pan);
int _stdcall GetPan(SNDBUF hBuff, int *pan);
 
int _stdcall GetMasterVol(int* vol);
int _stdcall SetMasterVol(int vol);
 
 
typedef struct
{
unsigned int riff_id;
unsigned int riff_size;
unsigned int riff_format;
 
unsigned int fmt_id;
unsigned int fmt_size;
 
unsigned short int wFormatTag;
unsigned short int nChannels;
unsigned int nSamplesPerSec;
unsigned int nAvgBytesPerSec;
unsigned short int nBlockAlign;
unsigned short int wBitsPerSample;
unsigned int data_id;
unsigned int data_size;
} WAVEHEADER;
 
 
unsigned int _stdcall test_wav(WAVEHEADER *hdr);
 
#ifdef __cplusplus
extern "C"
}
#endif
 
#endif //_SOUND_H_
/programs/games/doom/trunk/w_wad.c
42,22 → 42,10
 
extern char *main_file;
 
#ifdef DLHEAP
 
void* _cdecl dlmalloc(size_t);
void _cdecl dlfree(void*);
void _cdecl mf_init();
 
#define malloc dlmalloc
#define free dlfree
#define realloc dlrealloc
 
#endif
 
size_t FileSize(FILE *handle);
 
int _stdcall read_file (char *name, void *buff,
size_t offset, size_t count, size_t *reads);
//int _stdcall read_file (char *name, void *buff,
// size_t offset, size_t count, size_t *reads);
 
 
 
196,7 → 184,6
length = header.numlumps*sizeof(filelump_t);
 
fileinfo = alloca(length);
fseek (handle, header.infotableofs, SEEK_SET);
fread (fileinfo, 1, length, handle);
numlumps += header.numlumps;