diff options
Diffstat (limited to 'src/doom')
-rw-r--r-- | src/doom/am_map.c | 210 | ||||
-rw-r--r-- | src/doom/d_main.c | 3 | ||||
-rw-r--r-- | src/doom/deh_ammo.c | 1 | ||||
-rw-r--r-- | src/doom/g_game.c | 33 | ||||
-rw-r--r-- | src/doom/m_menu.c | 234 |
5 files changed, 296 insertions, 185 deletions
diff --git a/src/doom/am_map.c b/src/doom/am_map.c index 115a1878..37ccf5b3 100644 --- a/src/doom/am_map.c +++ b/src/doom/am_map.c @@ -90,19 +90,18 @@ // drawing stuff -#define AM_PANDOWNKEY KEY_DOWNARROW -#define AM_PANUPKEY KEY_UPARROW -#define AM_PANRIGHTKEY KEY_RIGHTARROW -#define AM_PANLEFTKEY KEY_LEFTARROW -#define AM_ZOOMINKEY '=' -#define AM_ZOOMOUTKEY '-' -#define AM_STARTKEY KEY_TAB -#define AM_ENDKEY KEY_TAB -#define AM_GOBIGKEY '0' -#define AM_FOLLOWKEY 'f' -#define AM_GRIDKEY 'g' -#define AM_MARKKEY 'm' -#define AM_CLEARMARKKEY 'c' +int key_map_north = KEY_UPARROW; +int key_map_south = KEY_DOWNARROW; +int key_map_east = KEY_RIGHTARROW; +int key_map_west = KEY_LEFTARROW; +int key_map_zoomin = '='; +int key_map_zoomout = '-'; +int key_map_toggle = KEY_TAB; +int key_map_maxzoom = '0'; +int key_map_follow = 'f'; +int key_map_grid = 'g'; +int key_map_mark = 'm'; +int key_map_clearmark = 'c'; #define AM_NUMMARKPOINTS 10 @@ -629,121 +628,136 @@ AM_Responder static int cheatstate=0; static int bigstate=0; static char buffer[20]; + int key; rc = false; if (!automapactive) { - if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY) + if (ev->type == ev_keydown && ev->data1 == key_map_toggle) { AM_Start (); viewactive = false; rc = true; } } - else if (ev->type == ev_keydown) { - rc = true; - switch(ev->data1) - { - case AM_PANRIGHTKEY: // pan right - if (!followplayer) m_paninc.x = FTOM(F_PANINC); - else rc = false; - break; - case AM_PANLEFTKEY: // pan left - if (!followplayer) m_paninc.x = -FTOM(F_PANINC); - else rc = false; - break; - case AM_PANUPKEY: // pan up - if (!followplayer) m_paninc.y = FTOM(F_PANINC); - else rc = false; - break; - case AM_PANDOWNKEY: // pan down - if (!followplayer) m_paninc.y = -FTOM(F_PANINC); - else rc = false; - break; - case AM_ZOOMOUTKEY: // zoom out - mtof_zoommul = M_ZOOMOUT; - ftom_zoommul = M_ZOOMIN; - break; - case AM_ZOOMINKEY: // zoom in - mtof_zoommul = M_ZOOMIN; - ftom_zoommul = M_ZOOMOUT; - break; - case AM_ENDKEY: - bigstate = 0; - viewactive = true; - AM_Stop (); - break; - case AM_GOBIGKEY: - bigstate = !bigstate; - if (bigstate) - { - AM_saveScaleAndLoc(); - AM_minOutWindowScale(); - } - else AM_restoreScaleAndLoc(); - break; - case AM_FOLLOWKEY: - followplayer = !followplayer; - f_oldloc.x = INT_MAX; + key = ev->data1; + + if (key == key_map_east) // pan right + { + if (!followplayer) m_paninc.x = FTOM(F_PANINC); + else rc = false; + } + else if (key == key_map_west) // pan left + { + if (!followplayer) m_paninc.x = -FTOM(F_PANINC); + else rc = false; + } + else if (key == key_map_north) // pan up + { + if (!followplayer) m_paninc.y = FTOM(F_PANINC); + else rc = false; + } + else if (key == key_map_south) // pan down + { + if (!followplayer) m_paninc.y = -FTOM(F_PANINC); + else rc = false; + } + else if (key == key_map_zoomout) // zoom out + { + mtof_zoommul = M_ZOOMOUT; + ftom_zoommul = M_ZOOMIN; + } + else if (key == key_map_zoomin) // zoom in + { + mtof_zoommul = M_ZOOMIN; + ftom_zoommul = M_ZOOMOUT; + } + else if (key == key_map_toggle) + { + bigstate = 0; + viewactive = true; + AM_Stop (); + } + else if (key == key_map_maxzoom) + { + bigstate = !bigstate; + if (bigstate) + { + AM_saveScaleAndLoc(); + AM_minOutWindowScale(); + } + else AM_restoreScaleAndLoc(); + } + else if (key == key_map_follow) + { + followplayer = !followplayer; + f_oldloc.x = INT_MAX; if (followplayer) plr->message = DEH_String(AMSTR_FOLLOWON); else plr->message = DEH_String(AMSTR_FOLLOWOFF); - break; - case AM_GRIDKEY: - grid = !grid; + } + else if (key == key_map_grid) + { + grid = !grid; if (grid) plr->message = DEH_String(AMSTR_GRIDON); else plr->message = DEH_String(AMSTR_GRIDOFF); - break; - case AM_MARKKEY: - sprintf(buffer, "%s %d", DEH_String(AMSTR_MARKEDSPOT), markpointnum); - plr->message = buffer; - AM_addMark(); - break; - case AM_CLEARMARKKEY: - AM_clearMarks(); - plr->message = DEH_String(AMSTR_MARKSCLEARED); - break; - default: - cheatstate=0; - rc = false; - } + } + else if (key == key_map_mark) + { + sprintf(buffer, "%s %d", DEH_String(AMSTR_MARKEDSPOT), markpointnum); + plr->message = buffer; + AM_addMark(); + } + else if (key == key_map_clearmark) + { + AM_clearMarks(); + plr->message = DEH_String(AMSTR_MARKSCLEARED); + } + else + { + cheatstate=0; + rc = false; + } + if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data2)) { rc = false; cheating = (cheating+1) % 3; } } - else if (ev->type == ev_keyup) { - rc = false; - switch (ev->data1) - { - case AM_PANRIGHTKEY: - if (!followplayer) m_paninc.x = 0; - break; - case AM_PANLEFTKEY: - if (!followplayer) m_paninc.x = 0; - break; - case AM_PANUPKEY: - if (!followplayer) m_paninc.y = 0; - break; - case AM_PANDOWNKEY: - if (!followplayer) m_paninc.y = 0; - break; - case AM_ZOOMOUTKEY: - case AM_ZOOMINKEY: - mtof_zoommul = FRACUNIT; - ftom_zoommul = FRACUNIT; - break; - } + rc = false; + key = ev->data1; + + if (key == key_map_east) + { + if (!followplayer) m_paninc.x = 0; + } + else if (key == key_map_west) + { + if (!followplayer) m_paninc.x = 0; + } + else if (key == key_map_north) + { + if (!followplayer) m_paninc.y = 0; + } + else if (key == key_map_south) + { + if (!followplayer) m_paninc.y = 0; + } + else if (key == key_map_zoomout || key == key_map_zoomin) + { + mtof_zoommul = FRACUNIT; + ftom_zoommul = FRACUNIT; + } } return rc; diff --git a/src/doom/d_main.c b/src/doom/d_main.c index daa62209..ce8f6ec8 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -1122,8 +1122,7 @@ void D_DoomMain (void) I_Error("Game mode indeterminate. No IWAD file was found. Try\n" "specifying one with the '-iwad' command line parameter.\n"); } - - setbuf (stdout, NULL); + modifiedgame = false; //! diff --git a/src/doom/deh_ammo.c b/src/doom/deh_ammo.c index eb26ef75..2c6a9022 100644 --- a/src/doom/deh_ammo.c +++ b/src/doom/deh_ammo.c @@ -28,6 +28,7 @@ #include <stdlib.h> #include <string.h> +#include "doomdef.h" #include "doomtype.h" #include "deh_defs.h" #include "deh_io.h" diff --git a/src/doom/g_game.c b/src/doom/g_game.c index c430a870..a2b08739 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -157,6 +157,15 @@ wbstartstruct_t wminfo; // parms for world map / intermission byte consistancy[MAXPLAYERS][BACKUPTICS]; +int key_weapon1 = '1'; +int key_weapon2 = '2'; +int key_weapon3 = '3'; +int key_weapon4 = '4'; +int key_weapon5 = '5'; +int key_weapon6 = '6'; +int key_weapon7 = '7'; +int key_weapon8 = '8'; + #define MAXPLMOVE (forwardmove[1]) #define TURBOTHRESHOLD 0x32 @@ -165,6 +174,17 @@ fixed_t forwardmove[2] = {0x19, 0x32}; fixed_t sidemove[2] = {0x18, 0x28}; fixed_t angleturn[3] = {640, 1280, 320}; // + slow turn +static int *weapon_keys[] = { + &key_weapon1, + &key_weapon2, + &key_weapon3, + &key_weapon4, + &key_weapon5, + &key_weapon6, + &key_weapon7, + &key_weapon8 +}; + #define SLOWTURNTICS 6 #define NUMKEYS 256 @@ -455,13 +475,18 @@ void G_BuildTiccmd (ticcmd_t* cmd) } // chainsaw overrides - for (i=0 ; i<NUMWEAPONS-1 ; i++) - if (gamekeydown['1'+i]) - { + + for (i=0; i<arrlen(weapon_keys); ++i) + { + int key = *weapon_keys[i]; + + if (gamekeydown[key]) + { cmd->buttons |= BT_CHANGE; cmd->buttons |= i<<BT_WEAPONSHIFT; break; - } + } + } // mouse if (mousebuttons[mousebforward]) diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c index 4ca30926..af3d1ae2 100644 --- a/src/doom/m_menu.c +++ b/src/doom/m_menu.c @@ -73,6 +73,35 @@ extern boolean message_dontfuckwithme; extern boolean chat_on; // in heads-up code // +// menu keys: +// + +int key_menu_activate = KEY_ESCAPE; +int key_menu_up = KEY_UPARROW; +int key_menu_down = KEY_DOWNARROW; +int key_menu_left = KEY_LEFTARROW; +int key_menu_right = KEY_RIGHTARROW; +int key_menu_back = KEY_BACKSPACE; +int key_menu_forward = KEY_ENTER; +int key_menu_confirm = 'y'; +int key_menu_abort = 'n'; + +int key_menu_help = KEY_F1; +int key_menu_save = KEY_F2; +int key_menu_load = KEY_F3; +int key_menu_volume = KEY_F4; +int key_menu_detail = KEY_F5; +int key_menu_qsave = KEY_F6; +int key_menu_endgame = KEY_F7; +int key_menu_messages = KEY_F8; +int key_menu_qload = KEY_F9; +int key_menu_quit = KEY_F10; +int key_menu_gamma = KEY_F11; + +int key_menu_incscreen = KEY_EQUALS; +int key_menu_decscreen = KEY_MINUS; + +// // defaulted values // int mouseSensitivity = 5; @@ -678,9 +707,9 @@ void M_SaveGame (int choice) // char tempstring[80]; -void M_QuickSaveResponse(int ch) +void M_QuickSaveResponse(int key) { - if (ch == 'y') + if (key == key_menu_confirm) { M_DoSave(quickSaveSlot); S_StartSound(NULL,sfx_swtchx); @@ -715,9 +744,9 @@ void M_QuickSave(void) // // M_QuickLoad // -void M_QuickLoadResponse(int ch) +void M_QuickLoadResponse(int key) { - if (ch == 'y') + if (key == key_menu_confirm) { M_LoadSelect(quickSaveSlot); S_StartSound(NULL,sfx_swtchx); @@ -935,9 +964,9 @@ void M_DrawEpisode(void) V_DrawPatchDirect(54, 38, W_CacheLumpName(DEH_String("M_EPISOD"), PU_CACHE)); } -void M_VerifyNightmare(int ch) +void M_VerifyNightmare(int key) { - if (ch != 'y') + if (key != key_menu_confirm) return; G_DeferedInitNew(nightmare,epi+1,1); @@ -1036,9 +1065,9 @@ void M_ChangeMessages(int choice) // // M_EndGame // -void M_EndGameResponse(int ch) +void M_EndGameResponse(int key) { - if (ch != 'y') + if (key != key_menu_confirm) return; currentMenu->lastOn = itemOn; @@ -1132,9 +1161,9 @@ int quitsounds2[8] = -void M_QuitResponse(int ch) +void M_QuitResponse(int key) { - if (ch != 'y') + if (key != key_menu_confirm) return; if (!netgame) { @@ -1441,34 +1470,34 @@ boolean M_Responder (event_t* ev) { if (ev->data3 == -1) { - key = KEY_UPARROW; + key = key_menu_up; joywait = I_GetTime() + 5; } else if (ev->data3 == 1) { - key = KEY_DOWNARROW; + key = key_menu_down; joywait = I_GetTime() + 5; } if (ev->data2 == -1) { - key = KEY_LEFTARROW; + key = key_menu_left; joywait = I_GetTime() + 2; } else if (ev->data2 == 1) { - key = KEY_RIGHTARROW; + key = key_menu_right; joywait = I_GetTime() + 2; } if (ev->data1&1) { - key = KEY_ENTER; + key = key_menu_forward; joywait = I_GetTime() + 5; } if (ev->data1&2) { - key = KEY_BACKSPACE; + key = key_menu_back; joywait = I_GetTime() + 5; } } @@ -1479,13 +1508,13 @@ boolean M_Responder (event_t* ev) mousey += ev->data3; if (mousey < lasty-30) { - key = KEY_DOWNARROW; + key = key_menu_down; mousewait = I_GetTime() + 5; mousey = lasty -= 30; } else if (mousey > lasty+30) { - key = KEY_UPARROW; + key = key_menu_up; mousewait = I_GetTime() + 5; mousey = lasty += 30; } @@ -1493,26 +1522,26 @@ boolean M_Responder (event_t* ev) mousex += ev->data2; if (mousex < lastx-30) { - key = KEY_LEFTARROW; + key = key_menu_left; mousewait = I_GetTime() + 5; mousex = lastx -= 30; } else if (mousex > lastx+30) { - key = KEY_RIGHTARROW; + key = key_menu_right; mousewait = I_GetTime() + 5; mousex = lastx += 30; } if (ev->data1&1) { - key = KEY_ENTER; + key = key_menu_forward; mousewait = I_GetTime() + 15; } if (ev->data1&2) { - key = KEY_BACKSPACE; + key = key_menu_back; mousewait = I_GetTime() + 15; } } @@ -1534,7 +1563,7 @@ boolean M_Responder (event_t* ev) if (testcontrols) { - if (key == KEY_ESCAPE || key == KEY_F10) + if (key == key_menu_activate || key == key_menu_quit) { I_Quit(); return true; @@ -1594,121 +1623,136 @@ boolean M_Responder (event_t* ev) // Take care of any messages that need input if (messageToPrint) { - if (messageNeedsInput == true && - !(ch == ' ' || ch == 'n' || ch == 'y' || key == KEY_ESCAPE)) - return false; - + if (messageNeedsInput) + { + if (key != ' ' && key != KEY_ESCAPE + && key != key_menu_confirm && key != key_menu_abort) + { + return false; + } + } + menuactive = messageLastMenuActive; messageToPrint = 0; if (messageRoutine) - messageRoutine(ch); - + messageRoutine(key); + menuactive = false; S_StartSound(NULL,sfx_swtchx); return true; } - - if (devparm && key == KEY_F1) + + if (devparm && key == key_menu_help) { G_ScreenShot (); return true; } - - + // F-Keys if (!menuactive) - switch(key) - { - case KEY_MINUS: // Screen size down + { + if (key == key_menu_decscreen) // 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 + } + else if (key == key_menu_incscreen) // Screen size up + { if (automapactive || chat_on) return false; M_SizeDisplay(1); S_StartSound(NULL,sfx_stnmov); return true; - - case KEY_F1: // Help key + } + else if (key == key_menu_help) // 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 + } + else if (key == key_menu_save) // Save + { M_StartControlPanel(); S_StartSound(NULL,sfx_swtchn); M_SaveGame(0); return true; - - case KEY_F3: // Load + } + else if (key == key_menu_load) // Load + { M_StartControlPanel(); S_StartSound(NULL,sfx_swtchn); M_LoadGame(0); return true; - - case KEY_F4: // Sound Volume + } + else if (key == key_menu_volume) // Sound Volume + { M_StartControlPanel (); currentMenu = &SoundDef; itemOn = sfx_vol; S_StartSound(NULL,sfx_swtchn); return true; - - case KEY_F5: // Detail toggle + } + else if (key == key_menu_detail) // Detail toggle + { M_ChangeDetail(0); S_StartSound(NULL,sfx_swtchn); return true; - - case KEY_F6: // Quicksave + } + else if (key == key_menu_qsave) // Quicksave + { S_StartSound(NULL,sfx_swtchn); M_QuickSave(); return true; - - case KEY_F7: // End game + } + else if (key == key_menu_endgame) // End game + { S_StartSound(NULL,sfx_swtchn); M_EndGame(0); return true; - - case KEY_F8: // Toggle messages + } + else if (key == key_menu_messages) // Toggle messages + { M_ChangeMessages(0); S_StartSound(NULL,sfx_swtchn); return true; - - case KEY_F9: // Quickload + } + else if (key == key_menu_qload) // Quickload + { S_StartSound(NULL,sfx_swtchn); M_QuickLoad(); return true; - - case KEY_F10: // Quit DOOM + } + else if (key == key_menu_quit) // Quit DOOM + { S_StartSound(NULL,sfx_swtchn); M_QuitDOOM(0); return true; - - case KEY_F11: // gamma toggle + } + else if (key == key_menu_gamma) // gamma toggle + { usegamma++; if (usegamma > 4) usegamma = 0; players[consoleplayer].message = DEH_String(gammamsg[usegamma]); I_SetPalette (W_CacheLumpName (DEH_String("PLAYPAL"),PU_CACHE)); return true; - } + } - // Pop-up menu? if (!menuactive) { - if (key == KEY_ESCAPE) + if (key == key_menu_activate) { M_StartControlPanel (); S_StartSound(NULL,sfx_swtchn); @@ -1719,19 +1763,25 @@ boolean M_Responder (event_t* ev) // Keys usable within menu - switch (key) + + if (key == key_menu_down) { - case KEY_DOWNARROW: - do + // Move down to next item + + 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: + } + else if (key == key_menu_up) + { + // Move back up to previous item + do { if (!itemOn) @@ -1739,9 +1789,13 @@ boolean M_Responder (event_t* ev) else itemOn--; S_StartSound(NULL,sfx_pstop); } while(currentMenu->menuitems[itemOn].status==-1); + return true; + } + else if (key == key_menu_left) + { + // Slide slider left - case KEY_LEFTARROW: if (currentMenu->menuitems[itemOn].routine && currentMenu->menuitems[itemOn].status == 2) { @@ -1749,8 +1803,11 @@ boolean M_Responder (event_t* ev) currentMenu->menuitems[itemOn].routine(0); } return true; - - case KEY_RIGHTARROW: + } + else if (key == key_menu_right) + { + // Slide slider right + if (currentMenu->menuitems[itemOn].routine && currentMenu->menuitems[itemOn].status == 2) { @@ -1758,8 +1815,11 @@ boolean M_Responder (event_t* ev) currentMenu->menuitems[itemOn].routine(1); } return true; + } + else if (key == key_menu_forward) + { + // Activate menu item - case KEY_ENTER: if (currentMenu->menuitems[itemOn].routine && currentMenu->menuitems[itemOn].status) { @@ -1776,14 +1836,20 @@ boolean M_Responder (event_t* ev) } } return true; - - case KEY_ESCAPE: + } + else if (key == key_menu_activate) + { + // Deactivate menu + currentMenu->lastOn = itemOn; M_ClearMenus (); S_StartSound(NULL,sfx_swtchx); return true; - - case KEY_BACKSPACE: + } + else if (key == key_menu_back) + { + // Go back to previous menu + currentMenu->lastOn = itemOn; if (currentMenu->prevMenu) { @@ -1792,24 +1858,30 @@ boolean M_Responder (event_t* ev) S_StartSound(NULL,sfx_swtchn); } return true; - - default: + } + else if (ch != 0) + { + // Keyboard shortcut? + 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; |