From 1cac2c76c6d8ce53921bcfd246372f377cde69f9 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 30 Nov 2019 06:10:16 +0000 Subject: [PATCH 1/8] SW: Add debug_break() to _Assert() git-svn-id: https://svn.eduke32.com/eduke32@8335 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/sw/src/game.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 500d0a689..8c644ea20 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -2657,9 +2657,11 @@ void Control() void _Assert(const char *expr, const char *strFile, unsigned uLine) { - sprintf(ds, "Assertion failed: %s %s, line %u", expr, strFile, uLine); - MONO_PRINT(ds); + buildprintf(ds, "Assertion failed: %s %s, line %u", expr, strFile, uLine); + debug_break(); + TerminateGame(); + #if 1 //def RENDERTYPEWIN wm_msgbox(apptitle, "%s", ds); #else From 8b78440f76aed25ade76f47b968bdbe4b521e6fd Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 30 Nov 2019 06:10:21 +0000 Subject: [PATCH 2/8] SW: Upgrade SoundAngle() from the original 5-bit precision to EDuke32's 7-bit git-svn-id: https://svn.eduke32.com/eduke32@8336 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/sw/src/sounds.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index 284d30b77..1adb8b18c 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -651,8 +651,8 @@ short SoundAngle(int x, int y) if (delta_angle < 0) delta_angle = NORM_ANGLE((1024 + delta_angle) + 1024); - // convert 2048 degree angle to 32 degree angle - return delta_angle >> 6; + // convert 2048 degree angle to 128 degree angle + return delta_angle >> 4; } int _PlayerSound(const char *file, int line, int num, int *x, int *y, int *z, Voc3D_Flags flags, PLAYERp pp) From 69c01587c73c7f5fa3badb16c89e8b05ec374609 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 30 Nov 2019 06:10:26 +0000 Subject: [PATCH 3/8] SW: Make quick save and load actually quick git-svn-id: https://svn.eduke32.com/eduke32@8337 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/game.cpp # source/sw/src/game.h # source/sw/src/menus.cpp --- source/sw/src/game.cpp | 67 +++++++++++++++++++++++++++++++++-------- source/sw/src/game.h | 6 ++++ source/sw/src/menus.cpp | 31 +++---------------- 3 files changed, 65 insertions(+), 39 deletions(-) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 8c644ea20..a3a3bb6c6 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -3336,10 +3336,46 @@ void ConKey(void) #endif } -void FunctionKeys(PLAYERp pp) +char WangBangMacro[10][64]; + +SWBOOL DoQuickSave(short save_num) +{ + PauseAction(); + + if (SaveGame(save_num) != -1) + { + QuickLoadNum = save_num; + + LastSaveNum = -1; + + return FALSE; + } + + return TRUE; +} + +SWBOOL DoQuickLoad() +{ + KB_ClearKeysDown(); + + PauseAction(); + + ReloadPrompt = FALSE; + if (LoadGame(QuickLoadNum) == -1) + { + return FALSE; + } + + ready2send = 1; + LastSaveNum = -1; + + return TRUE; +} + +void +FunctionKeys(PLAYERp pp) { extern SWBOOL GamePaused; - extern short QuickLoadNum; static int rts_delay = 0; int fn_key = 0; @@ -3433,16 +3469,25 @@ void FunctionKeys(PLAYERp pp) } } - // F6 option menu + // F6 quick save if (inputState.GetKeyStatus(KEYSC_F6)) { - extern SWBOOL QuickSaveMode; inputState.ClearKeyStatus(KEYSC_F6); if (!TEST(pp->Flags, PF_DEAD)) { inputState.SetKeyStatus(sc_Escape); - ControlPanelType = ct_savemenu; - QuickSaveMode = TRUE; + if (QuickLoadNum < 0) + { + KEY_PRESSED(KEYSC_ESC) = 1; + ControlPanelType = ct_savemenu; + } + else + { + KB_ClearKeysDown(); + KB_FlushKeyboardQueue(); + DoQuickSave(QuickLoadNum); + ResumeAction(); + } } } @@ -3455,17 +3500,16 @@ void FunctionKeys(PLAYERp pp) { if (QuickLoadNum < 0) { - PutStringInfoLine(pp, "Last saved game not found."); + KEY_PRESSED(KEYSC_ESC) = 1; + ControlPanelType = ct_loadmenu; } else { - inputState.ClearKeysDown(); - inputState.SetKeyStatus(sc_Escape); - ControlPanelType = ct_quickloadmenu; + DoQuickLoad(); + ResumeAction(); } } } - } @@ -3535,7 +3579,6 @@ void FunctionKeys(PLAYERp pp) void PauseKey(PLAYERp pp) { extern SWBOOL GamePaused,CheatInputMode; - extern short QuickLoadNum; extern SWBOOL enabled; if (inputState.GetKeyStatus(sc_Pause) && !CommEnabled && !InputMode && !UsingMenus && !CheatInputMode && !ConPanel) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index ecdb085c5..5aa48874b 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2372,6 +2372,12 @@ int COVERinsertsprite(short sectnum, short statnum); //returns (short)spritenu void AudioUpdate(void); // stupid +extern short LastSaveNum; +extern short QuickLoadNum; +void LoadSaveMsg(const char *msg); +SWBOOL DoQuickSave(short save_num); +SWBOOL DoQuickLoad(void); + struct GameInterface : ::GameInterface { int app_main() override; diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 933dd75d5..88aa9973d 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -68,7 +68,6 @@ short TimeLimitTable[9] = {0,3,5,10,15,20,30,45,60}; short QuickLoadNum = -1; char QuickLoadDescrDialog[128]; -SWBOOL QuickSaveMode = FALSE; SWBOOL SavePrompt = FALSE; extern SWBOOL InMenuLevel, LoadGameOutsideMoveLoop, LoadGameFromDemo; extern uint8_t RedBookSong[40]; @@ -570,7 +569,6 @@ MenuItem_p cust_callback_item; static void MNU_ClearDialog(void); static SWBOOL MNU_Dialog(void); -void LoadSaveMsg(const char *msg); static void MNU_ItemPreProcess(MenuGroup *group); static void MNU_SelectItem(MenuGroup *group, short index, SWBOOL draw); static void MNU_PushItem(MenuItem *item, SWBOOL draw); @@ -1796,24 +1794,17 @@ MNU_QuickLoadCustom(UserCall call, MenuItem_p item) // Y pressed cust_callback = NULL; - inputState.ClearKeysDown(); LoadSaveMsg("Loading..."); - PauseAction(); - - ReloadPrompt = FALSE; - if (LoadGame(QuickLoadNum) == -1) + if (DoQuickLoad() == FALSE) { ResumeAction(); return FALSE; } - ready2send = 1; - LastSaveNum = -1; - - // do a load game here - inputState.ClearKeysDown(); ExitMenus(); + + return TRUE; } inputState.ClearKeysDown(); @@ -2429,16 +2420,11 @@ SWBOOL MNU_GetSaveCustom(void) if (MenuInputMode) { - PauseAction(); - LoadSaveMsg("Saving..."); - if (SaveGame(save_num) != -1) + if (DoQuickSave(save_num) == FALSE) { - QuickLoadNum = save_num; - LoadGameGroup.cursor = save_num; - LastSaveNum = -1; } ResumeAction(); @@ -2523,15 +2509,6 @@ SWBOOL MNU_LoadSaveMove(UserCall call, MenuItem_p item) SaveGameInfo2[0] = 0; } - if (QuickSaveMode) - { - QuickSaveMode = FALSE; - MenuInputMode = TRUE; - strcpy(BackupSaveGameDescr, SaveGameDescr[game_num]); - inputState.ClearKeysDown(); - inputState.keyFlushChars(); - } - LastSaveNum = game_num; // input mode check From 8d2159ab709c57409605b796aacae52872545267 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 30 Nov 2019 06:10:33 +0000 Subject: [PATCH 4/8] SW: Implement Darts option, including bloody frames git-svn-id: https://svn.eduke32.com/eduke32@8338 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/menus.cpp # source/sw/src/panel.cpp # source/sw/src/sprite.cpp # source/sw/src/swconfig.cpp --- source/sw/src/draw.cpp | 6 +++--- source/sw/src/game.cpp | 3 ++- source/sw/src/game.h | 2 +- source/sw/src/menus.cpp | 5 +++++ source/sw/src/menus.h | 1 + source/sw/src/panel.cpp | 6 +++--- source/sw/src/settings.h | 1 + source/sw/src/sprite.cpp | 3 +-- source/sw/src/weapon.cpp | 2 +- 9 files changed, 18 insertions(+), 11 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 9d138852b..84934cff7 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -765,7 +765,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) //#define DART_REPEAT 6 //#define DART_PIC 2233 - if (useDarts) + if (gs.Darts) if (tu->ID == 1793 || tsp->picnum == 1793) { tsp->picnum = 2519; @@ -777,7 +777,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) #define DART_REPEAT 16 if (tu->ID == STAR1) { - if (useDarts) + if (gs.Darts) { tsp->picnum = DART_PIC; tsp->ang = NORM_ANGLE(tsp->ang - 512 - 24); @@ -841,7 +841,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) } } - if (useDarts) + if (gs.Darts) if (tsp->statnum == STAT_STAR_QUEUE) { tsp->picnum = DART_PIC; diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index a3a3bb6c6..5c5a489d9 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -208,6 +208,7 @@ const GAME_SET gs_defaults = 0, // Color TRUE, // nuke "Track??", // waveform track name + FALSE, }; GAME_SET gs; @@ -3014,7 +3015,7 @@ Nuke -> 0=Off 1=On commit -map grenade -autonet 0,0,1,1,1,0,3,2,1,1 -name frank #endif -char isShareware = FALSE, useDarts = FALSE; +char isShareware = FALSE; int DetectShareware(void) { diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 5aa48874b..da5d2ad94 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -50,7 +50,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS //#define SW_SHAREWARE 1 // This determines whether game is shareware compile or not! -extern char isShareware, useDarts; +extern char isShareware; #define SW_SHAREWARE (isShareware) // Turn warning off for unreferenced variables. diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 88aa9973d..73ca09cb1 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -397,6 +397,7 @@ MenuItem options_i[] = {DefButton(btn_auto_aim, 0, "Auto-Aiming"), OPT_XS, OPT_LINE(9), 1, m_defshade, 0, NULL, NULL, NULL}, {DefButton(btn_voxels, 0, "Voxel Sprites"), OPT_XS, OPT_LINE(10), 1, m_defshade, 0, NULL, NULL, NULL}, {DefButton(btn_stats, 0, "Level Stats"), OPT_XS, OPT_LINE(11), 1, m_defshade, 0, NULL, MNU_StatCheck, NULL}, + {DefButton(btn_darts, 0, "Use Darts"), OPT_XS, OPT_LINE(12), 1, m_defshade, 0, NULL, NULL, NULL}, {DefNone} }; @@ -1864,6 +1865,7 @@ MNU_InitMenus(void) buttonsettings[btn_playcd] = true;// gs.PlayCD; buttonsettings[btn_flipstereo] = snd_reversestereo; buttonsettings[btn_stats] = hud_stats; + buttonsettings[btn_darts] = gs.Darts; slidersettings[sldr_gametype] = gs.NetGameType; slidersettings[sldr_netlevel] = gs.NetLevel; @@ -2920,6 +2922,9 @@ void MNU_DoButton(MenuItem_p item, SWBOOL draw) case btn_stats: hud_stats = state = buttonsettings[item->button]; break; + case btn_darts: + gs.Darts = state = buttonsettings[item->button]; + break; case btn_markers: gs.NetSpawnMarkers = state = buttonsettings[item->button]; break; diff --git a/source/sw/src/menus.h b/source/sw/src/menus.h index 358935699..f05b5f4fb 100644 --- a/source/sw/src/menus.h +++ b/source/sw/src/menus.h @@ -212,6 +212,7 @@ typedef enum btn_markers, btn_teamplay, btn_friendlyfire,btn_parental,btn_nuke, btn_voxels, btn_stats, btn_playcd, btn_videofs, + btn_darts, btn_max } BTNType; diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index 823147ce3..21b0defb9 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -1822,7 +1822,7 @@ InitWeaponStar(PLAYERp pp) PlaySound(DIGI_PULL, &pp->posx, &pp->posy, &pp->posz, v3df_follow|v3df_dontpan); if (STD_RANDOM_RANGE(1000) > 900 && pp == Player+myconnectindex) { - if (!useDarts) + if (!gs.Darts) PlayerSound(DIGI_ILIKESHURIKEN,&pp->posx,&pp->posy,&pp->posz,v3df_follow|v3df_dontpan,pp); } @@ -7389,7 +7389,7 @@ pDisplaySprites(PLAYERp pp) picnum = psp->picndx; // UK panzies have to have darts instead of shurikens. - if (useDarts) + if (gs.Darts) switch (picnum) { case STAR_REST: @@ -7453,7 +7453,7 @@ pDisplaySprites(PLAYERp pp) case STAR_REST: case 2510: - if (!useDarts) + if (!gs.Darts) picnum = 2138; else picnum = 2518; // Bloody Dart Hand diff --git a/source/sw/src/settings.h b/source/sw/src/settings.h index c63f880d8..579743cf7 100644 --- a/source/sw/src/settings.h +++ b/source/sw/src/settings.h @@ -46,6 +46,7 @@ typedef struct SWBOOL NetNuke; //SWBOOL PlayCD; // Not implemented and no idea how to support it without the music assets. char WaveformTrackName[MAXWAVEFORMTRACKLENGTH]; + SWBOOL Darts; } GAME_SET, *GAME_SETp; extern const GAME_SET gs_defaults; diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index 3a7940bdf..a5d6da53a 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -5959,8 +5959,7 @@ KeyMain: if (pp->WpnAmmo[WPN_STAR] >= DamageData[WPN_STAR].max_ammo) break; - //if (useDarts) sprintf(ds,"Darts"); - //else sprintf(ds,"Shurikens"); + sprintf(ds, gs.Darts ? "Darts" : "Shurikens"); PutStringInfo(Player+pnum, DamageData[WPN_STAR].weapon_name); PlayerUpdateAmmo(pp, WPN_STAR, DamageData[WPN_STAR].weapon_pickup); SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index e92139b8a..fdfcd7b56 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -7492,7 +7492,7 @@ const char *DeathString(short SpriteNum) case 5011: return "blade"; case STAR1: - if (useDarts) return "dart"; + if (gs.Darts) return "dart"; else return "shuriken"; case CROSSBOLT: return "crossbow bolt"; From 15b8bc959f3992a829aefad225928df6da757da9 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 30 Nov 2019 06:10:40 +0000 Subject: [PATCH 5/8] SW: Add Equip Pickups weapon auto-switching toggle git-svn-id: https://svn.eduke32.com/eduke32@8339 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/swconfig.cpp --- source/sw/src/game.cpp | 1 + source/sw/src/menus.cpp | 5 +++++ source/sw/src/menus.h | 1 + source/sw/src/settings.h | 1 + source/sw/src/sprite.cpp | 30 ++++++++++++++++++++++++++++++ 5 files changed, 38 insertions(+) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 5c5a489d9..c32d63e0e 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -209,6 +209,7 @@ const GAME_SET gs_defaults = TRUE, // nuke "Track??", // waveform track name FALSE, + TRUE, }; GAME_SET gs; diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 73ca09cb1..6f67282bb 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -398,6 +398,7 @@ MenuItem options_i[] = {DefButton(btn_voxels, 0, "Voxel Sprites"), OPT_XS, OPT_LINE(10), 1, m_defshade, 0, NULL, NULL, NULL}, {DefButton(btn_stats, 0, "Level Stats"), OPT_XS, OPT_LINE(11), 1, m_defshade, 0, NULL, MNU_StatCheck, NULL}, {DefButton(btn_darts, 0, "Use Darts"), OPT_XS, OPT_LINE(12), 1, m_defshade, 0, NULL, NULL, NULL}, + {DefButton(btn_autoswitch, 0, "Equip Pickups"), OPT_XS, OPT_LINE(13), 1, m_defshade, 0, NULL, NULL, NULL}, {DefNone} }; @@ -1866,6 +1867,7 @@ MNU_InitMenus(void) buttonsettings[btn_flipstereo] = snd_reversestereo; buttonsettings[btn_stats] = hud_stats; buttonsettings[btn_darts] = gs.Darts; + buttonsettings[btn_autoswitch] = gs.WeaponAutoSwitch; slidersettings[sldr_gametype] = gs.NetGameType; slidersettings[sldr_netlevel] = gs.NetLevel; @@ -2925,6 +2927,9 @@ void MNU_DoButton(MenuItem_p item, SWBOOL draw) case btn_darts: gs.Darts = state = buttonsettings[item->button]; break; + case btn_autoswitch: + gs.WeaponAutoSwitch = state = buttonsettings[item->button]; + break; case btn_markers: gs.NetSpawnMarkers = state = buttonsettings[item->button]; break; diff --git a/source/sw/src/menus.h b/source/sw/src/menus.h index f05b5f4fb..bf707d95e 100644 --- a/source/sw/src/menus.h +++ b/source/sw/src/menus.h @@ -213,6 +213,7 @@ typedef enum btn_voxels, btn_stats, btn_playcd, btn_videofs, btn_darts, + btn_autoswitch, btn_max } BTNType; diff --git a/source/sw/src/settings.h b/source/sw/src/settings.h index 579743cf7..4eda4a023 100644 --- a/source/sw/src/settings.h +++ b/source/sw/src/settings.h @@ -47,6 +47,7 @@ typedef struct //SWBOOL PlayCD; // Not implemented and no idea how to support it without the music assets. char WaveformTrackName[MAXWAVEFORMTRACKLENGTH]; SWBOOL Darts; + SWBOOL WeaponAutoSwitch; } GAME_SET, *GAME_SETp; extern const GAME_SET gs_defaults; diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index a5d6da53a..ae1fda491 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -5969,6 +5969,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_STAR))) break; SET(pp->WpnFlags, BIT(WPN_STAR)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum <= WPN_STAR && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponStar(pp); @@ -5994,6 +5997,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_MINE))) break; SET(pp->WpnFlags, BIT(WPN_MINE)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_MINE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponMine(pp); @@ -6035,6 +6041,9 @@ KeyMain: ChoosePlayerGetSound(pp); } + if (!gs.WeaponAutoSwitch) + break; + if (User[pp->PlayerSprite]->WeaponNum > WPN_UZI && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; @@ -6074,6 +6083,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_MICRO))) break; SET(pp->WpnFlags, BIT(WPN_MICRO)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_MICRO && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponMicro(pp); @@ -6142,6 +6154,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_GRENADE))) break; SET(pp->WpnFlags, BIT(WPN_GRENADE)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_GRENADE && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponGrenade(pp); @@ -6168,6 +6183,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_ROCKET))) break; SET(pp->WpnFlags, BIT(WPN_ROCKET)); + + if (!gs.WeaponAutoSwitch) + break; InitWeaponRocket(pp); break; @@ -6212,6 +6230,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_RAIL))) break; SET(pp->WpnFlags, BIT(WPN_RAIL)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_RAIL && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponRail(pp); @@ -6251,6 +6272,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_SHOTGUN))) break; SET(pp->WpnFlags, BIT(WPN_SHOTGUN)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_SHOTGUN && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponShotgun(pp); @@ -6317,6 +6341,9 @@ KeyMain: if (TEST(pp->WpnFlags, BIT(WPN_HOTHEAD))) break; SET(pp->WpnFlags, BIT(WPN_NAPALM) | BIT(WPN_RING) | BIT(WPN_HOTHEAD)); + + if (!gs.WeaponAutoSwitch) + break; if (User[pp->PlayerSprite]->WeaponNum > WPN_HOTHEAD && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; InitWeaponHothead(pp); @@ -6361,6 +6388,9 @@ KeyMain: break; SET(pp->WpnFlags, BIT(WPN_HEART)); + if (!gs.WeaponAutoSwitch) + break; + if (User[pp->PlayerSprite]->WeaponNum > WPN_HEART && User[pp->PlayerSprite]->WeaponNum != WPN_SWORD) break; From 361a964067cba4cf1bb9dc9e5d341ed5a5e1702e Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 30 Nov 2019 06:10:44 +0000 Subject: [PATCH 6/8] SW: Fix NUMGAMEFUNCTIONS and mouse button select menu git-svn-id: https://svn.eduke32.com/eduke32@8340 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/function.h # source/sw/src/menus.cpp --- source/sw/src/menus.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 6f67282bb..3c8836f62 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -836,7 +836,7 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc) // Todo: Branch off to the generic keybind menu. const int PGSIZ = 9; const char *strs[] = { "Select the function to assign to", "%s", "or ESCAPE to cancel." }; - int topitem = 0, botitem = NUMGAMEFUNCTIONS-1; + int topitem = 0, botitem = NUMGAMEFUNCTIONS; int i, j, y; short w, h=0; int returnval = 0; @@ -853,13 +853,13 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc) } else if (inputState.GetKeyStatus(sc_End)) { - *currentfunc = NUMGAMEFUNCTIONS-1; // -1 because the last one is the console and the top is 'none' + *currentfunc = NUMGAMEFUNCTIONS; inputState.ClearKeyStatus(sc_End); } else if (inputState.GetKeyStatus(sc_PgDn)) { *currentfunc += PGSIZ; - if (*currentfunc >= NUMGAMEFUNCTIONS) *currentfunc = NUMGAMEFUNCTIONS-1; + if (*currentfunc > NUMGAMEFUNCTIONS) *currentfunc = NUMGAMEFUNCTIONS; inputState.ClearKeyStatus(sc_PgDn); } else if (inputState.GetKeyStatus(sc_PgUp)) @@ -881,11 +881,11 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc) else if (I_MenuDown()) { I_MenuDownClear(); - *currentfunc = min(NUMGAMEFUNCTIONS - 1, *currentfunc + 1); + *currentfunc = min(NUMGAMEFUNCTIONS, *currentfunc + 1); } - if (NUMGAMEFUNCTIONS-1 > PGSIZ) + if (NUMGAMEFUNCTIONS > PGSIZ) { topitem = *currentfunc - PGSIZ/2; botitem = topitem + PGSIZ; @@ -895,9 +895,9 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc) botitem += -topitem; topitem = 0; } - else if (botitem >= NUMGAMEFUNCTIONS) + else if (botitem > NUMGAMEFUNCTIONS) { - botitem = NUMGAMEFUNCTIONS-1; + botitem = NUMGAMEFUNCTIONS; topitem = botitem - PGSIZ; } } @@ -941,7 +941,7 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc) MNU_MeasureSmallString(morestr,&dx,&dy); if (topitem > 0) MNU_DrawSmallString(XDIM - OPT_XS - dx, OPT_LINE(4), morestr, 8,16); - if (botitem < NUMGAMEFUNCTIONS-1) + if (botitem < NUMGAMEFUNCTIONS) MNU_DrawSmallString(XDIM - OPT_XS - dx, OPT_LINE(4)+PGSIZ*8, morestr, 8,16); } From 769b359928def4744b0181e92a0391b47891359b Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 30 Nov 2019 06:10:54 +0000 Subject: [PATCH 7/8] SW: Add Alt Weapon Mode gamefunc and bind it to MOUSE3 by default git-svn-id: https://svn.eduke32.com/eduke32@8342 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/sw/src/_functio.h # source/sw/src/function.h --- source/sw/src/game.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index c32d63e0e..213ef2113 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -4299,6 +4299,14 @@ void getinput(SW_PACKET *loc) SET(loc->bits, prev_weapon + 1); } + if (buttonMap.ButtonDown(gamefunc_Alt_Weapon_Mode)) + { + buttonMap.ClearButton(gamefunc_Alt_Weapon_Mode); + USERp u = User[pp->PlayerSprite]; + short const which_weapon = u->WeaponNum + 1; + SET(loc->bits, which_weapon); + } + inv_hotkey = 0; if (buttonMap.ButtonDown(gamefunc_Med_Kit)) inv_hotkey = INVENTORY_MEDKIT+1; From 68668058c9faebf0e5c51287c746fc6b894ed971 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 30 Nov 2019 06:10:58 +0000 Subject: [PATCH 8/8] SW: Fix cheats only granting one Uzi instead of two git-svn-id: https://svn.eduke32.com/eduke32@8343 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/sw/src/cheats.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source/sw/src/cheats.cpp b/source/sw/src/cheats.cpp index 8c7ce438b..e44e2ff0b 100644 --- a/source/sw/src/cheats.cpp +++ b/source/sw/src/cheats.cpp @@ -167,6 +167,12 @@ void WeaponCheat(PLAYERp pp, const char *) p = &Player[pnum]; u = User[p->PlayerSprite]; + if (!TEST(p->Flags, PF_TWO_UZI)) + { + SET(p->Flags, PF_TWO_UZI); + SET(p->Flags, PF_PICKED_UP_AN_UZI); + } + // ALL WEAPONS if (!SW_SHAREWARE) p->WpnFlags = 0xFFFFFFFF; @@ -248,13 +254,6 @@ void ItemCheat(PLAYERp pp, const char *cheat_string) p = &Player[pnum]; memset(p->HasKey, TRUE, sizeof(p->HasKey)); - if (p->Wpn[WPN_UZI] && p->CurWpn == p->Wpn[WPN_UZI]) - { - SET(p->Flags, PF_TWO_UZI); - SET(p->Flags, PF_PICKED_UP_AN_UZI); - InitWeaponUzi(p); - } - p->WpnShotgunAuto = 50; p->WpnRocketHeat = 5; p->WpnRocketNuke = 1;