OnMotorcycle etc.

This commit is contained in:
Christoph Oelckers 2020-05-22 08:56:42 +02:00
parent d6f1c76c9d
commit e113851a39
3 changed files with 149 additions and 169 deletions

View file

@ -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

View file

@ -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)

View file

@ -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
{