From e113851a39aa2ba7e80597df91ca5b69a53f90d5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 22 May 2020 08:56:42 +0200 Subject: [PATCH] OnMotorcycle etc. --- source/games/duke/src/player_r.cpp | 149 +++++++++++++++++++++++++++++ source/games/duke/src/zz_game.cpp | 144 ---------------------------- source/rr/src/game.cpp | 25 ----- 3 files changed, 149 insertions(+), 169 deletions(-) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 0f27b3265..062d81833 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -4253,6 +4253,12 @@ HORIZONLY: } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void processweapon_r(int s, int ss, int p) { processweapon(s, ss, p); @@ -4273,4 +4279,147 @@ void processmove_r(int snum, int sb_snum, int psect, int fz, int cz, int shrunk, } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void OnMotorcycle(struct player_struct *p, int motosprite) +{ + if (!p->OnMotorcycle && !(sector[p->cursectnum].lotag == 2)) + { + if (motosprite) + { + p->posx = sprite[motosprite].x; + p->posy = sprite[motosprite].y; + p->setang(sprite[motosprite].ang); + p->ammo_amount[MOTORCYCLE_WEAPON] = sprite[motosprite].owner; + deletesprite(motosprite); + } + p->over_shoulder_on = 0; + p->OnMotorcycle = 1; + p->last_full_weapon = p->curr_weapon; + p->curr_weapon = MOTORCYCLE_WEAPON; + p->gotweapon.Set(MOTORCYCLE_WEAPON); + p->posxv = 0; + p->posyv = 0; + p->sethoriz(100); + } + if (!A_CheckSoundPlaying(p->i,186)) + A_PlaySound(186, p->i); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void OffMotorcycle(struct player_struct *p) +{ + short j; + if (p->OnMotorcycle) + { + if (A_CheckSoundPlaying(p->i,188)) + S_StopEnvSound(188,p->i); + if (A_CheckSoundPlaying(p->i,187)) + S_StopEnvSound(187,p->i); + if (A_CheckSoundPlaying(p->i,186)) + S_StopEnvSound(186,p->i); + if (A_CheckSoundPlaying(p->i,214)) + S_StopEnvSound(214,p->i); + if (!A_CheckSoundPlaying(p->i,42)) + A_PlaySound(42, p->i); + p->OnMotorcycle = 0; + p->gotweapon.Clear(MOTORCYCLE_WEAPON); + p->curr_weapon = p->last_full_weapon; + checkavailweapon(p); + p->sethoriz(100); + p->moto_do_bump = 0; + p->MotoSpeed = 0; + p->TiltStatus = 0; + p->moto_drink = 0; + p->VBumpTarget = 0; + p->VBumpNow = 0; + p->TurbCount = 0; + p->posxv = 0; + p->posyv = 0; + p->posxv -= sintable[(p->getang()+512)&2047]<<7; + p->posyv -= sintable[p->getang()&2047]<<7; + p->moto_underwater = 0; + j = fi.spawn(p->i, EMPTYBIKE); + sprite[j].ang = p->getang(); + sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; + sprite[j].yvel += sintable[p->getang()&2047]<<7; + sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON]; + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void OnBoat(struct player_struct *p, int boatsprite) +{ + if (!p->OnBoat) + { + if (boatsprite) + { + p->posx = sprite[boatsprite].x; + p->posy = sprite[boatsprite].y; + p->setang(sprite[boatsprite].ang); + p->ammo_amount[BOAT_WEAPON] = sprite[boatsprite].owner; + deletesprite(boatsprite); + } + p->over_shoulder_on = 0; + p->OnBoat = 1; + p->last_full_weapon = p->curr_weapon; + p->curr_weapon = BOAT_WEAPON; + p->gotweapon.Set(BOAT_WEAPON); + p->posxv = 0; + p->posyv = 0; + p->sethoriz(100); + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void OffBoat(struct player_struct *p) +{ + short j; + if (p->OnBoat) + { + p->OnBoat = 0; + p->gotweapon.Clear(BOAT_WEAPON); + p->curr_weapon = p->last_full_weapon; + checkavailweapon(p); + p->sethoriz(100); + p->moto_do_bump = 0; + p->MotoSpeed = 0; + p->TiltStatus = 0; + p->moto_drink = 0; + p->VBumpTarget = 0; + p->VBumpNow = 0; + p->TurbCount = 0; + p->posxv = 0; + p->posyv = 0; + p->posxv -= sintable[(p->getang()+512)&2047]<<7; + p->posyv -= sintable[p->getang()&2047]<<7; + p->moto_underwater = 0; + j = fi.spawn(p->i, EMPTYBOAT); + sprite[j].ang = p->getang(); + sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; + sprite[j].yvel += sintable[p->getang()&2047]<<7; + sprite[j].owner = p->ammo_amount[BOAT_WEAPON]; + } +} + + END_DUKE_NS diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 472da7372..b50305c99 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -73,8 +73,6 @@ int32_t vote_map = -1, vote_episode = -1; int32_t g_Debug = 0; -const char *defaultrtsfilename[GAMECOUNT] = { "DUKE.RTS", "REDNECK.RTS", "REDNECK.RTS", "NAM.RTS", "NAPALM.RTS" }; - int32_t g_Shareware = 0; int32_t tempwallptr; @@ -91,30 +89,6 @@ int32_t g_levelTextTime = 0; extern char forcegl; #endif -const char *G_DefaultRtsFile(void) -{ - if (DUKE) - return defaultrtsfilename[GAME_DUKE]; - else if (NAPALM) - { - if (!fileSystem.FileExists(defaultrtsfilename[GAME_NAPALM]) && fileSystem.FileExists(defaultrtsfilename[GAME_NAM])) - return defaultrtsfilename[GAME_NAM]; // NAM/NAPALM Sharing - else - return defaultrtsfilename[GAME_NAPALM]; - } - else if (NAM) - { - if (!fileSystem.FileExists(defaultrtsfilename[GAME_NAM]) && fileSystem.FileExists(defaultrtsfilename[GAME_NAPALM])) - return defaultrtsfilename[GAME_NAPALM]; // NAM/NAPALM Sharing - else - return defaultrtsfilename[GAME_NAM]; - } - else if (RR) - return defaultrtsfilename[GAME_RR]; - - return defaultrtsfilename[0]; -} - enum gametokens { T_INCLUDE = 0, @@ -191,124 +165,6 @@ void G_GameQuit(void) } -void OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum) -{ - if (!pPlayer->OnMotorcycle && !(sector[pPlayer->cursectnum].lotag == 2)) - { - if (spriteNum) - { - pPlayer->pos.x = sprite[spriteNum].x; - pPlayer->pos.y = sprite[spriteNum].y; - pPlayer->q16ang = F16(sprite[spriteNum].ang); - pPlayer->ammo_amount[MOTORCYCLE_WEAPON] = sprite[spriteNum].owner; - A_DeleteSprite(spriteNum); - } - pPlayer->over_shoulder_on = 0; - pPlayer->OnMotorcycle = 1; - pPlayer->last_full_weapon = pPlayer->curr_weapon; - pPlayer->curr_weapon = MOTORCYCLE_WEAPON; - pPlayer->gotweapon.Set(MOTORCYCLE_WEAPON); - pPlayer->vel.x = 0; - pPlayer->vel.y = 0; - pPlayer->q16horiz = F16(100); - } - if (!A_CheckSoundPlaying(pPlayer->i,186)) - A_PlaySound(186, pPlayer->i); -} - -void OffMotorcycle(DukePlayer_t *pPlayer) -{ - int j; - if (pPlayer->OnMotorcycle) - { - if (A_CheckSoundPlaying(pPlayer->i,188)) - S_StopEnvSound(188,pPlayer->i); - if (A_CheckSoundPlaying(pPlayer->i,187)) - S_StopEnvSound(187,pPlayer->i); - if (A_CheckSoundPlaying(pPlayer->i,186)) - S_StopEnvSound(186,pPlayer->i); - if (A_CheckSoundPlaying(pPlayer->i,214)) - S_StopEnvSound(214,pPlayer->i); - if (!A_CheckSoundPlaying(pPlayer->i,42)) - A_PlaySound(42, pPlayer->i); - pPlayer->OnMotorcycle = 0; - pPlayer->gotweapon.Clear(MOTORCYCLE_WEAPON); - pPlayer->curr_weapon = pPlayer->last_full_weapon; - P_CheckWeapon(pPlayer); - pPlayer->q16horiz = F16(100); - pPlayer->moto_do_bump = 0; - pPlayer->MotoSpeed = 0; - pPlayer->TiltStatus = 0; - pPlayer->moto_drink = 0; - pPlayer->VBumpTarget = 0; - pPlayer->VBumpNow = 0; - pPlayer->TurbCount = 0; - pPlayer->vel.x = 0; - pPlayer->vel.y = 0; - pPlayer->vel.x -= sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7; - pPlayer->vel.y -= sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7; - pPlayer->moto_underwater = 0; - j = fi.spawn(pPlayer->i, TILE_EMPTYBIKE); - sprite[j].ang = fix16_to_int(pPlayer->q16ang); - sprite[j].xvel += sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7; - sprite[j].yvel += sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7; - sprite[j].owner = pPlayer->ammo_amount[MOTORCYCLE_WEAPON]; - } -} - -void OnBoat(DukePlayer_t *pPlayer, int spriteNum) -{ - if (!pPlayer->OnBoat) - { - if (spriteNum) - { - pPlayer->pos.x = sprite[spriteNum].x; - pPlayer->pos.y = sprite[spriteNum].y; - pPlayer->q16ang = F16(sprite[spriteNum].ang); - pPlayer->ammo_amount[BOAT_WEAPON] = sprite[spriteNum].owner; - deletesprite(spriteNum); - } - pPlayer->over_shoulder_on = 0; - pPlayer->OnBoat = 1; - pPlayer->last_full_weapon = pPlayer->curr_weapon; - pPlayer->curr_weapon = BOAT_WEAPON; - pPlayer->gotweapon.Set(BOAT_WEAPON); - pPlayer->vel.x = 0; - pPlayer->vel.y = 0; - pPlayer->q16horiz = F16(100); - } -} - -void OffBoat(DukePlayer_t *pPlayer) -{ - int j; - if (pPlayer->OnBoat) - { - pPlayer->OnBoat = 0; - pPlayer->gotweapon.Clear(BOAT_WEAPON); - pPlayer->curr_weapon = pPlayer->last_full_weapon; - P_CheckWeapon(pPlayer); - pPlayer->q16horiz = F16(100); - pPlayer->moto_do_bump = 0; - pPlayer->MotoSpeed = 0; - pPlayer->TiltStatus = 0; - pPlayer->moto_drink = 0; - pPlayer->VBumpTarget = 0; - pPlayer->VBumpNow = 0; - pPlayer->TurbCount = 0; - pPlayer->vel.x = 0; - pPlayer->vel.y = 0; - pPlayer->vel.x -= sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7; - pPlayer->vel.y -= sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7; - pPlayer->moto_underwater = 0; - j = fi.spawn(pPlayer->i, TILE_EMPTYBOAT); - sprite[j].ang = fix16_to_int(pPlayer->q16ang); - sprite[j].xvel += sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7; - sprite[j].yvel += sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7; - sprite[j].owner = pPlayer->ammo_amount[BOAT_WEAPON]; - } -} - void G_GameExit(const char *msg) diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index fa71f062d..c33ffe202 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -78,8 +78,6 @@ int32_t vote_map = -1, vote_episode = -1; int32_t g_Debug = 0; -const char *defaultrtsfilename[GAMECOUNT] = { "DUKE.RTS", "REDNECK.RTS", "REDNECK.RTS", "NAM.RTS", "NAPALM.RTS" }; - int32_t g_Shareware = 0; int32_t tempwallptr; @@ -96,29 +94,6 @@ int32_t g_levelTextTime = 0; extern char forcegl; #endif -const char *G_DefaultRtsFile(void) -{ - if (DUKE) - return defaultrtsfilename[GAME_DUKE]; - else if (NAPALM) - { - if (!fileSystem.FileExists(defaultrtsfilename[GAME_NAPALM]) && fileSystem.FileExists(defaultrtsfilename[GAME_NAM])) - return defaultrtsfilename[GAME_NAM]; // NAM/NAPALM Sharing - else - return defaultrtsfilename[GAME_NAPALM]; - } - else if (NAM) - { - if (!fileSystem.FileExists(defaultrtsfilename[GAME_NAM]) && fileSystem.FileExists(defaultrtsfilename[GAME_NAPALM])) - return defaultrtsfilename[GAME_NAPALM]; // NAM/NAPALM Sharing - else - return defaultrtsfilename[GAME_NAM]; - } - else if (RR) - return defaultrtsfilename[GAME_RR]; - - return defaultrtsfilename[0]; -} enum gametokens {