From a34f5debe868827bc27c4deef0bc0a31025a421b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2020 12:23:31 +0100 Subject: [PATCH] - route the shared control CCMDs through the game interface instead of registering local variants for each game. --- source/blood/src/blood.cpp | 1 - source/blood/src/blood.h | 4 ++ source/blood/src/misc.h | 1 - source/blood/src/osdcmd.cpp | 48 ++++++--------------- source/core/gamestruct.h | 4 ++ source/core/inputstate.cpp | 49 +++++++++++++++++++++ source/exhumed/src/exhumed.h | 2 + source/exhumed/src/osdcmds.cpp | 36 +++++----------- source/games/duke/src/animatesprites_d.cpp | 2 +- source/games/duke/src/animatesprites_r.cpp | 2 +- source/games/duke/src/bowling.cpp | 3 -- source/games/duke/src/ccmds.cpp | 50 +++++++--------------- source/games/duke/src/cheats.cpp | 1 - source/games/duke/src/duke3d.h | 4 ++ source/games/duke/src/gameexec.cpp | 4 +- source/games/duke/src/premap.cpp | 2 +- source/games/duke/src/types.h | 1 - source/sw/src/game.h | 3 ++ source/sw/src/osdcmds.cpp | 42 ++++++------------ 19 files changed, 123 insertions(+), 136 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 90ae275c8..3980f5395 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -512,7 +512,6 @@ void GameInterface::app_init() Printf(PRINT_NONOTIFY, "Initializing sound system\n"); sndInit(); - registerosdcommands(); gChoke.init(518, chokeCallback); UpdateDacs(0, true); diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index aaa50aae4..788841e26 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -100,6 +100,10 @@ struct GameInterface : ::GameInterface fixed_t playerHorizMin() override { return IntToFixed(-180); } fixed_t playerHorizMax() override { return IntToFixed(120); } int playerKeyMove() override { return 1024; } + void WarpToCoords(int x, int y, int z, int a, int h) override; + void ToggleThirdPerson() override; + void SwitchCoopView() override; + void ToggleShowWeapon() override; GameStats getStats() override; }; diff --git a/source/blood/src/misc.h b/source/blood/src/misc.h index 10c5c4297..7ca3e24bb 100644 --- a/source/blood/src/misc.h +++ b/source/blood/src/misc.h @@ -41,7 +41,6 @@ void InitMirrors(void); void sub_5571C(char mode); void sub_557C4(int x, int y, int interpolation); void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int viewPlayer); -int32_t registerosdcommands(void); int qanimateoffs(int a1, int a2); int32_t qgetpalookup(int32_t a1, int32_t a2); void HookReplaceFunctions(); diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index bab85c9e9..69f72714d 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -38,44 +38,38 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static int osdcmd_warptocoords(CCmdFuncPtr parm) +void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) { - if (parm->numparms < 3 || parm->numparms > 5) - return CCMD_SHOWHELP; - PLAYER *pPlayer = &gPlayer[myconnectindex]; VIEW* pView = &gPrevView[myconnectindex]; - pPlayer->pSprite->x = pView->at50 = gView->pSprite->x = atoi(parm->parms[0]); - pPlayer->pSprite->y = pView->at54 = gView->pSprite->y = atoi(parm->parms[1]); - pPlayer->zView = pView->at38 = gView->zView = atoi(parm->parms[2]); + pPlayer->pSprite->x = pView->at50 = gView->pSprite->x = x; + pPlayer->pSprite->y = pView->at54 = gView->pSprite->y = y; + pPlayer->zView = pView->at38 = gView->zView = z; - if (parm->numparms >= 4) + if (ang != INT_MIN) { - pPlayer->angle.oang = pPlayer->angle.ang = pView->at30 = gView->angle.ang = buildang(atoi(parm->parms[3])); + pPlayer->angle.oang = pPlayer->angle.ang = pView->at30 = gView->angle.ang = buildang(ang); } - if (parm->numparms == 5) + if (horz != INT_MIN) { - pPlayer->horizon.ohoriz = pPlayer->horizon.horiz = pView->at24 = gView->horizon.horiz = buildhoriz(atoi(parm->parms[4])); + pPlayer->horizon.ohoriz = pPlayer->horizon.horiz = pView->at24 = gView->horizon.horiz = buildhoriz(horz); } - - return CCMD_OK; } -static int osdcmd_third_person_view(CCmdFuncPtr parm) +void GameInterface::ToggleThirdPerson() { - if (gamestate != GS_LEVEL) return CCMD_OK; + if (gamestate != GS_LEVEL) return; if (gViewPos > VIEWPOS_0) gViewPos = VIEWPOS_0; else gViewPos = VIEWPOS_1; - return CCMD_OK; } -static int osdcmd_coop_view(CCmdFuncPtr parm) +void GameInterface::SwitchCoopView() { - if (gamestate != GS_LEVEL) return CCMD_OK; + if (gamestate != GS_LEVEL) return; if (gGameOptions.nGameType == 1) { gViewIndex = connectpoint2[gViewIndex]; @@ -96,26 +90,12 @@ static int osdcmd_coop_view(CCmdFuncPtr parm) } while (oldViewIndex != gViewIndex); gView = &gPlayer[gViewIndex]; } - return CCMD_OK; } -static int osdcmd_show_weapon(CCmdFuncPtr parm) +void GameInterface::ToggleShowWeapon() { - if (gamestate != GS_LEVEL) return CCMD_OK; + if (gamestate != GS_LEVEL) return; cl_showweapon = (cl_showweapon + 1) & 3; - return CCMD_OK; -} - - - -int32_t registerosdcommands(void) -{ - C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords); - C_RegisterFunction("third_person_view", "Switch to third person view", osdcmd_third_person_view); - C_RegisterFunction("coop_view", "Switch player to view from in coop", osdcmd_coop_view); - C_RegisterFunction("show_weapon", "Show opponents' weapons", osdcmd_show_weapon); - - return 0; } END_BLD_NS diff --git a/source/core/gamestruct.h b/source/core/gamestruct.h index 13024630a..4e303f6fc 100644 --- a/source/core/gamestruct.h +++ b/source/core/gamestruct.h @@ -93,6 +93,10 @@ struct GameInterface virtual fixed_t playerHorizMin() { return IntToFixed(-200); } virtual fixed_t playerHorizMax() { return IntToFixed(200); } virtual int playerKeyMove() { return 0; } + virtual void WarpToCoords(int x, int y, int z, int a, int h) {} + virtual void ToggleThirdPerson() { } + virtual void SwitchCoopView() { Printf("Unsupported command\n"); } + virtual void ToggleShowWeapon() { Printf("Unsupported command\n"); } virtual FString statFPS() { diff --git a/source/core/inputstate.cpp b/source/core/inputstate.cpp index ca660482f..762652512 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -41,6 +41,8 @@ #include"packet.h" #include "gamecontrol.h" #include "gamestruct.h" +#include "d_net.h" +#include "gamestate.h" static int WeaponToSend = 0; ESyncBits ActionsToSend = 0; @@ -327,6 +329,53 @@ CCMD(pause) sendPause = true; } +CCMD(warptocoords) +{ + if (netgame) + { + Printf("warptocoords cannot be used in multiplayer.\n"); + return; + } + if (argv.argc() <= 4) + { + Printf("warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates\n"); + return; + } + if (gamestate != GS_LEVEL) + { + Printf("warptocoords: must be in a level\n"); + return; + } + int x = atoi(argv[1]); + int y = atoi(argv[2]); + int z = atoi(argv[3]); + int ang = INT_MIN, horiz = INT_MIN; + if (argv.argc() > 4) + { + ang = atoi(argv[4]); + } + if (argv.argc() > 5) + { + horiz = atoi(argv[5]); + } + + gi->WarpToCoords(x, y, z, ang, horiz); +} + +CCMD(third_person_view) +{ + gi->ToggleThirdPerson(); +} + +CCMD(coop_view) +{ + gi->SwitchCoopView(); +} + +CCMD(show_weapon) +{ + gi->ToggleShowWeapon(); +} void ApplyGlobalInput(InputPacket& input, ControlInfo* hidInput, bool const crouchable, bool const disableToggle) { diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 9dc236dcb..37647dd12 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -267,6 +267,8 @@ struct GameInterface : ::GameInterface fixed_t playerHorizMin() override { return IntToFixed(-150); } fixed_t playerHorizMax() override { return IntToFixed(150); } int playerKeyMove() override { return 6; } + void WarpToCoords(int x, int y, int z, int a, int h) override; + void ToggleThirdPerson() override; ::GameStats getStats() override; }; diff --git a/source/exhumed/src/osdcmds.cpp b/source/exhumed/src/osdcmds.cpp index 1ae6f36f3..4ee24d7f6 100644 --- a/source/exhumed/src/osdcmds.cpp +++ b/source/exhumed/src/osdcmds.cpp @@ -36,29 +36,24 @@ BEGIN_PS_NS static bool gamesetinput = false; -static int osdcmd_warptocoords(CCmdFuncPtr parm) +void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) { - if (parm->numparms < 3 || parm->numparms > 5) - return CCMD_SHOWHELP; - Player *nPlayer = &PlayerList[nLocalPlayer]; spritetype *pSprite = &sprite[nPlayer->nSprite]; - nPlayer->opos.x = pSprite->x = atoi(parm->parms[0]); - nPlayer->opos.y = pSprite->y = atoi(parm->parms[1]); - nPlayer->opos.z = pSprite->z = atoi(parm->parms[2]); + nPlayer->opos.x = pSprite->x = x; + nPlayer->opos.y = pSprite->y = y; + nPlayer->opos.z = pSprite->z = z; - if (parm->numparms >= 4) + if (ang != INT_MIN) { - nPlayer->angle.oang = nPlayer->angle.ang = buildang(atoi(parm->parms[3])); + nPlayer->angle.oang = nPlayer->angle.ang = buildang(ang); } - if (parm->numparms == 5) + if (horz != INT_MIN) { - nPlayer->horizon.ohoriz = nPlayer->horizon.horiz = buildhoriz(atoi(parm->parms[4])); + nPlayer->horizon.ohoriz = nPlayer->horizon.horiz = buildhoriz(horz); } - - return CCMD_OK; } static int osdcmd_doors(CCmdFuncPtr parm) @@ -105,9 +100,9 @@ static int osdcmd_spawn(CCmdFuncPtr parm) return CCMD_OK; } -static int osdcmd_third_person_view(CCmdFuncPtr parm) +void GameInterface::ToggleThirdPerson() { - if (gamestate != GS_LEVEL) return CCMD_OK; + if (gamestate != GS_LEVEL) return; if (!nFreeze) { bCamera = !bCamera; @@ -122,25 +117,14 @@ static int osdcmd_third_person_view(CCmdFuncPtr parm) { gamesetinput = cl_syncinput = false; } - return CCMD_OK; } -static int osdcmd_noop(CCmdFuncPtr parm) -{ - // this is for silencing key bindings only. - return CCMD_OK; -} - int32_t registerosdcommands(void) { //if (VOLUMEONE) C_RegisterFunction("doors", "opens/closes doors", osdcmd_doors); C_RegisterFunction("spawn","spawn : spawns a creature",osdcmd_spawn); - C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords); - C_RegisterFunction("third_person_view", "Switch to third person view", osdcmd_third_person_view); - C_RegisterFunction("coop_view", "Switch player to view from in coop", osdcmd_noop); - C_RegisterFunction("show_weapon", "Show opponents' weapons", osdcmd_noop); return 0; } diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 0a76369e0..369b22bd6 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -337,7 +337,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio) } } - if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && ud.showweapons && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) + if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) { auto newtspr = &tsprite[spritesortcnt]; memcpy(newtspr, t, sizeof(spritetype)); diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 89d8b9694..a87c11ee4 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -384,7 +384,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio) } } - if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && ud.showweapons && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) + if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) { auto newtspr = &tsprite[spritesortcnt]; memcpy(newtspr, t, sizeof(spritetype)); diff --git a/source/games/duke/src/bowling.cpp b/source/games/duke/src/bowling.cpp index 70283953b..876e95f85 100644 --- a/source/games/duke/src/bowling.cpp +++ b/source/games/duke/src/bowling.cpp @@ -33,9 +33,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms BEGIN_DUKE_NS -short pinsectorresetdown(short sect); - - void ballreturn(DDukeActor *ball) { DukeStatIterator it(STAT_BOWLING); diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index f082ec62e..ed4ae4578 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -103,33 +103,28 @@ static int ccmd_spawn(CCmdFuncPtr parm) return CCMD_OK; } -static int osdcmd_warptocoords(CCmdFuncPtr parm) +void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) { - if (parm->numparms < 3 || parm->numparms > 5) - return CCMD_SHOWHELP; - player_struct* p = &ps[myconnectindex]; - p->oposx = p->posx = atoi(parm->parms[0]); - p->oposy = p->posy = atoi(parm->parms[1]); - p->oposz = p->posz = atoi(parm->parms[2]); + p->oposx = p->posx = x; + p->oposy = p->posy = y; + p->oposz = p->posz = z; - if (parm->numparms >= 4) + if (ang != INT_MIN) { - p->angle.oang = p->angle.ang = buildang(atoi(parm->parms[3])); + p->angle.oang = p->angle.ang = buildang(ang); } - if (parm->numparms == 5) + if (horz != INT_MIN) { - p->horizon.ohoriz = p->horizon.horiz = buildhoriz(atoi(parm->parms[4])); + p->horizon.ohoriz = p->horizon.horiz = buildhoriz(horz); } - - return CCMD_OK; } -static int osdcmd_third_person_view(CCmdFuncPtr parm) +void GameInterface::ToggleThirdPerson() { - if (gamestate != GS_LEVEL) return CCMD_OK; + if (gamestate != GS_LEVEL) return; if (!isRRRA() || (!ps[myconnectindex].OnMotorcycle && !ps[myconnectindex].OnBoat)) { if (ps[myconnectindex].over_shoulder_on) @@ -142,42 +137,29 @@ static int osdcmd_third_person_view(CCmdFuncPtr parm) } FTA(QUOTE_VIEW_MODE_OFF + ps[myconnectindex].over_shoulder_on, &ps[myconnectindex]); } - return CCMD_OK; } -static int osdcmd_coop_view(CCmdFuncPtr parm) +void GameInterface::SwitchCoopView() { - if (gamestate != GS_LEVEL) return CCMD_OK; + if (gamestate != GS_LEVEL) return; if (ud.coop || ud.recstat == 2) { screenpeek = connectpoint2[screenpeek]; if (screenpeek == -1) screenpeek = 0; } - return CCMD_OK; } -static int osdcmd_show_weapon(CCmdFuncPtr parm) +void GameInterface::ToggleShowWeapon() { - if (gamestate != GS_LEVEL) return CCMD_OK; - if (ud.multimode > 1) - { - ud.showweapons = 1 - ud.showweapons; - cl_showweapon = ud.showweapons; - FTA(QUOTE_WEAPON_MODE_OFF - ud.showweapons, &ps[screenpeek]); - } - - return CCMD_OK; + if (gamestate != GS_LEVEL) return; + cl_showweapon = cl_showweapon == 0; + FTA(QUOTE_WEAPON_MODE_OFF - cl_showweapon, &ps[screenpeek]); } int registerosdcommands(void) { C_RegisterFunction("spawn","spawn [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn); - C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords); - C_RegisterFunction("third_person_view", "Switch to third person view", osdcmd_third_person_view); - C_RegisterFunction("coop_view", "Switch player to view from in coop", osdcmd_coop_view); - C_RegisterFunction("show_weapon", "Show opponents' weapons", osdcmd_show_weapon); - return 0; } diff --git a/source/games/duke/src/cheats.cpp b/source/games/duke/src/cheats.cpp index 4ebc0c75d..f96519bfc 100644 --- a/source/games/duke/src/cheats.cpp +++ b/source/games/duke/src/cheats.cpp @@ -291,7 +291,6 @@ static bool cheatItems(int player) static bool cheatLevel(cheatseq_t *s) { - lastlevel = 0; int volnume,levnume; volnume = s->Args[0] - '0' - 1; levnume = (s->Args[1] - '0')*10+(s->Args[2]-'0') - 1; diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 17a513a12..0d484c29b 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -59,6 +59,10 @@ struct GameInterface : public ::GameInterface void LevelCompleted(MapRecord* map, int skill) override; bool DrawAutomapPlayer(int x, int y, int z, int a) override; int playerKeyMove() override { return 40; } + void WarpToCoords(int x, int y, int z, int a, int h) override; + void ToggleThirdPerson() override; + void SwitchCoopView() override; + void ToggleShowWeapon() override; }; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 5d2368f13..e52cc3cea 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -126,8 +126,8 @@ static void DoUserDef(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* break; case USERDEFS_SHOWWEAPONS: - if (bSet) ud.showweapons = lValue; - else SetGameVarID((int)lVar2, ud.showweapons, sActor, sPlayer); + // Read-only user state. + if (!bSet) SetGameVarID((int)lVar2, cl_showweapon, sActor, sPlayer); break; case USERDEFS_FROM_BONUS: diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 09763c05a..a2248f1e4 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -919,6 +919,7 @@ void enterlevel(MapRecord *mi, int gamemode) ud.monsters_off = ud.m_monsters_off; ud.coop = ud.m_coop; ud.ffire = ud.m_ffire; + lastlevel = 0; OnEvent(EVENT_ENTERLEVEL); @@ -994,7 +995,6 @@ void startnewgame(MapRecord* map, int skill) newgame(map, skill, [=](bool) { enterlevel(map, 0); - ud.showweapons = cl_showweapon; PlayerColorChanged(); inputState.ClearAllInput(); gameaction = ga_level; diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 95f4f0bd2..000dc1454 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -126,7 +126,6 @@ struct user_defs int levelclock; unsigned char god, cashman, eog; unsigned char clipping; - unsigned char showweapons; unsigned char user_pals[MAXPLAYERS]; short from_bonus; diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 032d71a2a..bc06bfbe7 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2186,6 +2186,9 @@ struct GameInterface : ::GameInterface void NewGame(MapRecord *map, int skill) override; bool DrawAutomapPlayer(int x, int y, int z, int a) override; int playerKeyMove() override { return 35; } + void WarpToCoords(int x, int y, int z, int a, int h) override; + void ToggleThirdPerson() override; + void SwitchCoopView() override; GameStats getStats() override; diff --git a/source/sw/src/osdcmds.cpp b/source/sw/src/osdcmds.cpp index fd98ca6db..d4c785d6a 100644 --- a/source/sw/src/osdcmds.cpp +++ b/source/sw/src/osdcmds.cpp @@ -48,26 +48,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_SW_NS -static int osdcmd_warptocoords(CCmdFuncPtr parm) +void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz) { - if (parm->numparms < 3 || parm->numparms > 5) - return CCMD_SHOWHELP; + Player->oposx = Player->posx = x; + Player->oposy = Player->posy = y; + Player->oposz = Player->posz = z; - Player->oposx = Player->posx = atoi(parm->parms[0]); - Player->oposy = Player->posy = atoi(parm->parms[1]); - Player->oposz = Player->posz = atoi(parm->parms[2]); - - if (parm->numparms >= 4) + if (ang != INT_MIN) { - Player->angle.oang = Player->angle.ang = buildang(atoi(parm->parms[3])); + Player->angle.oang = Player->angle.ang = buildang(ang); } - if (parm->numparms == 5) + if (horz != INT_MIN) { - Player->horizon.ohoriz = Player->horizon.horiz = buildhoriz(atoi(parm->parms[4])); + Player->horizon.ohoriz = Player->horizon.horiz = buildhoriz(horz); } - - return CCMD_OK; } static int osdcmd_mirror(CCmdFuncPtr parm) @@ -100,9 +95,9 @@ static int osdcmd_mirror(CCmdFuncPtr parm) return CCMD_OK; } -static int osdcmd_third_person_view(CCmdFuncPtr parm) +void GameInterface::ToggleThirdPerson() { - if (gamestate != GS_LEVEL) return CCMD_OK; + if (gamestate != GS_LEVEL) return; auto pp = &Player[myconnectindex]; if (inputState.ShiftPressed()) { @@ -121,12 +116,11 @@ static int osdcmd_third_person_view(CCmdFuncPtr parm) pp->camera_dist = 0; } } - return CCMD_OK; } -static int osdcmd_coop_view(CCmdFuncPtr parm) +void GameInterface::SwitchCoopView() { - if (gamestate != GS_LEVEL) return CCMD_OK; + if (gamestate != GS_LEVEL) return; if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE) { screenpeek = connectpoint2[screenpeek]; @@ -148,23 +142,11 @@ static int osdcmd_coop_view(CCmdFuncPtr parm) DoPlayerNightVisionPalette(tp); } } - return CCMD_OK; -} - -static int osdcmd_noop(CCmdFuncPtr parm) -{ - // this is for silencing key bindings only. - return CCMD_OK; } int32_t registerosdcommands(void) { C_RegisterFunction("mirror_debug", "mirror [mirrornum]: print mirror debug info", osdcmd_mirror); - C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords); - C_RegisterFunction("third_person_view", "Switch to third person view", osdcmd_third_person_view); - C_RegisterFunction("coop_view", "Switch player to view from in coop", osdcmd_coop_view); - C_RegisterFunction("show_weapon", "Show opponents' weapons", osdcmd_noop); - return 0; }