mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- route the shared control CCMDs through the game interface instead of registering local variants for each game.
This commit is contained in:
parent
48b16d5233
commit
a34f5debe8
19 changed files with 123 additions and 136 deletions
|
@ -512,7 +512,6 @@ void GameInterface::app_init()
|
||||||
|
|
||||||
Printf(PRINT_NONOTIFY, "Initializing sound system\n");
|
Printf(PRINT_NONOTIFY, "Initializing sound system\n");
|
||||||
sndInit();
|
sndInit();
|
||||||
registerosdcommands();
|
|
||||||
|
|
||||||
gChoke.init(518, chokeCallback);
|
gChoke.init(518, chokeCallback);
|
||||||
UpdateDacs(0, true);
|
UpdateDacs(0, true);
|
||||||
|
|
|
@ -100,6 +100,10 @@ struct GameInterface : ::GameInterface
|
||||||
fixed_t playerHorizMin() override { return IntToFixed(-180); }
|
fixed_t playerHorizMin() override { return IntToFixed(-180); }
|
||||||
fixed_t playerHorizMax() override { return IntToFixed(120); }
|
fixed_t playerHorizMax() override { return IntToFixed(120); }
|
||||||
int playerKeyMove() override { return 1024; }
|
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;
|
GameStats getStats() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,6 @@ void InitMirrors(void);
|
||||||
void sub_5571C(char mode);
|
void sub_5571C(char mode);
|
||||||
void sub_557C4(int x, int y, int interpolation);
|
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);
|
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);
|
int qanimateoffs(int a1, int a2);
|
||||||
int32_t qgetpalookup(int32_t a1, int32_t a2);
|
int32_t qgetpalookup(int32_t a1, int32_t a2);
|
||||||
void HookReplaceFunctions();
|
void HookReplaceFunctions();
|
||||||
|
|
|
@ -38,44 +38,38 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
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];
|
PLAYER *pPlayer = &gPlayer[myconnectindex];
|
||||||
VIEW* pView = &gPrevView[myconnectindex];
|
VIEW* pView = &gPrevView[myconnectindex];
|
||||||
|
|
||||||
pPlayer->pSprite->x = pView->at50 = gView->pSprite->x = atoi(parm->parms[0]);
|
pPlayer->pSprite->x = pView->at50 = gView->pSprite->x = x;
|
||||||
pPlayer->pSprite->y = pView->at54 = gView->pSprite->y = atoi(parm->parms[1]);
|
pPlayer->pSprite->y = pView->at54 = gView->pSprite->y = y;
|
||||||
pPlayer->zView = pView->at38 = gView->zView = atoi(parm->parms[2]);
|
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)
|
if (gViewPos > VIEWPOS_0)
|
||||||
gViewPos = VIEWPOS_0;
|
gViewPos = VIEWPOS_0;
|
||||||
else
|
else
|
||||||
gViewPos = VIEWPOS_1;
|
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)
|
if (gGameOptions.nGameType == 1)
|
||||||
{
|
{
|
||||||
gViewIndex = connectpoint2[gViewIndex];
|
gViewIndex = connectpoint2[gViewIndex];
|
||||||
|
@ -96,26 +90,12 @@ static int osdcmd_coop_view(CCmdFuncPtr parm)
|
||||||
} while (oldViewIndex != gViewIndex);
|
} while (oldViewIndex != gViewIndex);
|
||||||
gView = &gPlayer[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;
|
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
|
END_BLD_NS
|
||||||
|
|
|
@ -93,6 +93,10 @@ struct GameInterface
|
||||||
virtual fixed_t playerHorizMin() { return IntToFixed(-200); }
|
virtual fixed_t playerHorizMin() { return IntToFixed(-200); }
|
||||||
virtual fixed_t playerHorizMax() { return IntToFixed(200); }
|
virtual fixed_t playerHorizMax() { return IntToFixed(200); }
|
||||||
virtual int playerKeyMove() { return 0; }
|
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()
|
virtual FString statFPS()
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
#include"packet.h"
|
#include"packet.h"
|
||||||
#include "gamecontrol.h"
|
#include "gamecontrol.h"
|
||||||
#include "gamestruct.h"
|
#include "gamestruct.h"
|
||||||
|
#include "d_net.h"
|
||||||
|
#include "gamestate.h"
|
||||||
|
|
||||||
static int WeaponToSend = 0;
|
static int WeaponToSend = 0;
|
||||||
ESyncBits ActionsToSend = 0;
|
ESyncBits ActionsToSend = 0;
|
||||||
|
@ -327,6 +329,53 @@ CCMD(pause)
|
||||||
sendPause = true;
|
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)
|
void ApplyGlobalInput(InputPacket& input, ControlInfo* hidInput, bool const crouchable, bool const disableToggle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -267,6 +267,8 @@ struct GameInterface : ::GameInterface
|
||||||
fixed_t playerHorizMin() override { return IntToFixed(-150); }
|
fixed_t playerHorizMin() override { return IntToFixed(-150); }
|
||||||
fixed_t playerHorizMax() override { return IntToFixed(150); }
|
fixed_t playerHorizMax() override { return IntToFixed(150); }
|
||||||
int playerKeyMove() override { return 6; }
|
int playerKeyMove() override { return 6; }
|
||||||
|
void WarpToCoords(int x, int y, int z, int a, int h) override;
|
||||||
|
void ToggleThirdPerson() override;
|
||||||
|
|
||||||
::GameStats getStats() override;
|
::GameStats getStats() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,29 +36,24 @@ BEGIN_PS_NS
|
||||||
|
|
||||||
static bool gamesetinput = false;
|
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];
|
Player *nPlayer = &PlayerList[nLocalPlayer];
|
||||||
spritetype *pSprite = &sprite[nPlayer->nSprite];
|
spritetype *pSprite = &sprite[nPlayer->nSprite];
|
||||||
|
|
||||||
nPlayer->opos.x = pSprite->x = atoi(parm->parms[0]);
|
nPlayer->opos.x = pSprite->x = x;
|
||||||
nPlayer->opos.y = pSprite->y = atoi(parm->parms[1]);
|
nPlayer->opos.y = pSprite->y = y;
|
||||||
nPlayer->opos.z = pSprite->z = atoi(parm->parms[2]);
|
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)
|
static int osdcmd_doors(CCmdFuncPtr parm)
|
||||||
|
@ -105,9 +100,9 @@ static int osdcmd_spawn(CCmdFuncPtr parm)
|
||||||
return CCMD_OK;
|
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)
|
if (!nFreeze)
|
||||||
{
|
{
|
||||||
bCamera = !bCamera;
|
bCamera = !bCamera;
|
||||||
|
@ -122,25 +117,14 @@ static int osdcmd_third_person_view(CCmdFuncPtr parm)
|
||||||
{
|
{
|
||||||
gamesetinput = cl_syncinput = false;
|
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)
|
int32_t registerosdcommands(void)
|
||||||
{
|
{
|
||||||
//if (VOLUMEONE)
|
//if (VOLUMEONE)
|
||||||
C_RegisterFunction("doors", "opens/closes doors", osdcmd_doors);
|
C_RegisterFunction("doors", "opens/closes doors", osdcmd_doors);
|
||||||
C_RegisterFunction("spawn","spawn <creaturetype>: spawns a creature",osdcmd_spawn);
|
C_RegisterFunction("spawn","spawn <creaturetype>: 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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];
|
auto newtspr = &tsprite[spritesortcnt];
|
||||||
memcpy(newtspr, t, sizeof(spritetype));
|
memcpy(newtspr, t, sizeof(spritetype));
|
||||||
|
|
|
@ -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];
|
auto newtspr = &tsprite[spritesortcnt];
|
||||||
memcpy(newtspr, t, sizeof(spritetype));
|
memcpy(newtspr, t, sizeof(spritetype));
|
||||||
|
|
|
@ -33,9 +33,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
short pinsectorresetdown(short sect);
|
|
||||||
|
|
||||||
|
|
||||||
void ballreturn(DDukeActor *ball)
|
void ballreturn(DDukeActor *ball)
|
||||||
{
|
{
|
||||||
DukeStatIterator it(STAT_BOWLING);
|
DukeStatIterator it(STAT_BOWLING);
|
||||||
|
|
|
@ -103,33 +103,28 @@ static int ccmd_spawn(CCmdFuncPtr parm)
|
||||||
return CCMD_OK;
|
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];
|
player_struct* p = &ps[myconnectindex];
|
||||||
|
|
||||||
p->oposx = p->posx = atoi(parm->parms[0]);
|
p->oposx = p->posx = x;
|
||||||
p->oposy = p->posy = atoi(parm->parms[1]);
|
p->oposy = p->posy = y;
|
||||||
p->oposz = p->posz = atoi(parm->parms[2]);
|
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 (!isRRRA() || (!ps[myconnectindex].OnMotorcycle && !ps[myconnectindex].OnBoat))
|
||||||
{
|
{
|
||||||
if (ps[myconnectindex].over_shoulder_on)
|
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]);
|
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)
|
if (ud.coop || ud.recstat == 2)
|
||||||
{
|
{
|
||||||
screenpeek = connectpoint2[screenpeek];
|
screenpeek = connectpoint2[screenpeek];
|
||||||
if (screenpeek == -1) screenpeek = 0;
|
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 (gamestate != GS_LEVEL) return;
|
||||||
if (ud.multimode > 1)
|
cl_showweapon = cl_showweapon == 0;
|
||||||
{
|
FTA(QUOTE_WEAPON_MODE_OFF - cl_showweapon, &ps[screenpeek]);
|
||||||
ud.showweapons = 1 - ud.showweapons;
|
|
||||||
cl_showweapon = ud.showweapons;
|
|
||||||
FTA(QUOTE_WEAPON_MODE_OFF - ud.showweapons, &ps[screenpeek]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CCMD_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int registerosdcommands(void)
|
int registerosdcommands(void)
|
||||||
{
|
{
|
||||||
C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn);
|
C_RegisterFunction("spawn","spawn <picnum> [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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,6 @@ static bool cheatItems(int player)
|
||||||
|
|
||||||
static bool cheatLevel(cheatseq_t *s)
|
static bool cheatLevel(cheatseq_t *s)
|
||||||
{
|
{
|
||||||
lastlevel = 0;
|
|
||||||
int volnume,levnume;
|
int volnume,levnume;
|
||||||
volnume = s->Args[0] - '0' - 1;
|
volnume = s->Args[0] - '0' - 1;
|
||||||
levnume = (s->Args[1] - '0')*10+(s->Args[2]-'0') - 1;
|
levnume = (s->Args[1] - '0')*10+(s->Args[2]-'0') - 1;
|
||||||
|
|
|
@ -59,6 +59,10 @@ struct GameInterface : public ::GameInterface
|
||||||
void LevelCompleted(MapRecord* map, int skill) override;
|
void LevelCompleted(MapRecord* map, int skill) override;
|
||||||
bool DrawAutomapPlayer(int x, int y, int z, int a) override;
|
bool DrawAutomapPlayer(int x, int y, int z, int a) override;
|
||||||
int playerKeyMove() override { return 40; }
|
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;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -126,8 +126,8 @@ static void DoUserDef(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor*
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USERDEFS_SHOWWEAPONS:
|
case USERDEFS_SHOWWEAPONS:
|
||||||
if (bSet) ud.showweapons = lValue;
|
// Read-only user state.
|
||||||
else SetGameVarID((int)lVar2, ud.showweapons, sActor, sPlayer);
|
if (!bSet) SetGameVarID((int)lVar2, cl_showweapon, sActor, sPlayer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USERDEFS_FROM_BONUS:
|
case USERDEFS_FROM_BONUS:
|
||||||
|
|
|
@ -919,6 +919,7 @@ void enterlevel(MapRecord *mi, int gamemode)
|
||||||
ud.monsters_off = ud.m_monsters_off;
|
ud.monsters_off = ud.m_monsters_off;
|
||||||
ud.coop = ud.m_coop;
|
ud.coop = ud.m_coop;
|
||||||
ud.ffire = ud.m_ffire;
|
ud.ffire = ud.m_ffire;
|
||||||
|
lastlevel = 0;
|
||||||
|
|
||||||
OnEvent(EVENT_ENTERLEVEL);
|
OnEvent(EVENT_ENTERLEVEL);
|
||||||
|
|
||||||
|
@ -994,7 +995,6 @@ void startnewgame(MapRecord* map, int skill)
|
||||||
newgame(map, skill, [=](bool)
|
newgame(map, skill, [=](bool)
|
||||||
{
|
{
|
||||||
enterlevel(map, 0);
|
enterlevel(map, 0);
|
||||||
ud.showweapons = cl_showweapon;
|
|
||||||
PlayerColorChanged();
|
PlayerColorChanged();
|
||||||
inputState.ClearAllInput();
|
inputState.ClearAllInput();
|
||||||
gameaction = ga_level;
|
gameaction = ga_level;
|
||||||
|
|
|
@ -126,7 +126,6 @@ struct user_defs
|
||||||
int levelclock;
|
int levelclock;
|
||||||
unsigned char god, cashman, eog;
|
unsigned char god, cashman, eog;
|
||||||
unsigned char clipping;
|
unsigned char clipping;
|
||||||
unsigned char showweapons;
|
|
||||||
unsigned char user_pals[MAXPLAYERS];
|
unsigned char user_pals[MAXPLAYERS];
|
||||||
|
|
||||||
short from_bonus;
|
short from_bonus;
|
||||||
|
|
|
@ -2186,6 +2186,9 @@ struct GameInterface : ::GameInterface
|
||||||
void NewGame(MapRecord *map, int skill) override;
|
void NewGame(MapRecord *map, int skill) override;
|
||||||
bool DrawAutomapPlayer(int x, int y, int z, int a) override;
|
bool DrawAutomapPlayer(int x, int y, int z, int a) override;
|
||||||
int playerKeyMove() override { return 35; }
|
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;
|
GameStats getStats() override;
|
||||||
|
|
|
@ -48,26 +48,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_SW_NS
|
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)
|
Player->oposx = Player->posx = x;
|
||||||
return CCMD_SHOWHELP;
|
Player->oposy = Player->posy = y;
|
||||||
|
Player->oposz = Player->posz = z;
|
||||||
|
|
||||||
Player->oposx = Player->posx = atoi(parm->parms[0]);
|
if (ang != INT_MIN)
|
||||||
Player->oposy = Player->posy = atoi(parm->parms[1]);
|
|
||||||
Player->oposz = Player->posz = atoi(parm->parms[2]);
|
|
||||||
|
|
||||||
if (parm->numparms >= 4)
|
|
||||||
{
|
{
|
||||||
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)
|
static int osdcmd_mirror(CCmdFuncPtr parm)
|
||||||
|
@ -100,9 +95,9 @@ static int osdcmd_mirror(CCmdFuncPtr parm)
|
||||||
return CCMD_OK;
|
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];
|
auto pp = &Player[myconnectindex];
|
||||||
if (inputState.ShiftPressed())
|
if (inputState.ShiftPressed())
|
||||||
{
|
{
|
||||||
|
@ -121,12 +116,11 @@ static int osdcmd_third_person_view(CCmdFuncPtr parm)
|
||||||
pp->camera_dist = 0;
|
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)
|
if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
|
||||||
{
|
{
|
||||||
screenpeek = connectpoint2[screenpeek];
|
screenpeek = connectpoint2[screenpeek];
|
||||||
|
@ -148,23 +142,11 @@ static int osdcmd_coop_view(CCmdFuncPtr parm)
|
||||||
DoPlayerNightVisionPalette(tp);
|
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)
|
int32_t registerosdcommands(void)
|
||||||
{
|
{
|
||||||
C_RegisterFunction("mirror_debug", "mirror [mirrornum]: print mirror debug info", osdcmd_mirror);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue