- make moveactors work and RR weapon name cleanup.

# Conflicts:
#	source/games/duke/src/sbar.cpp
This commit is contained in:
Christoph Oelckers 2020-05-09 11:44:50 +02:00
parent 7b75a0683a
commit 242f78de13
10 changed files with 645 additions and 585 deletions

View file

@ -206,13 +206,8 @@ void checkavailweapon(struct player_struct* p)
snum = sprite[p->i].yvel;
// Note: RedNukem has this restriction, but the original source and RedneckGDX do not.
#if 1 // TRANSITIONAL
int max = ((isRR()) ? DEVISTATOR_WEAPON : FREEZE_WEAPON);
#else
int max = FREEZE_WEAPON;
#endif
for (i = 0; i < 10; i++)
int max = MAX_WEAPON;
for (i = 0; i <= max; i++)
{
weap = ud.wchoice[snum][i];
if ((g_gameType & GAMEFLAG_SHAREWARE) && weap > 6) continue;
@ -220,11 +215,11 @@ void checkavailweapon(struct player_struct* p)
if (weap == 0) weap = max;
else weap--;
if (weap == KNEE_WEAPON || (p->gotweapon[weap] && p->ammo_amount[weap] > 0))
if (weap == MIN_WEAPON || (p->gotweapon[weap] && p->ammo_amount[weap] > 0))
break;
}
if (i == HANDREMOTE_WEAPON) weap = KNEE_WEAPON;
if (i == MAX_WEAPON) weap = MIN_WEAPON;
// Found the weapon
@ -1734,7 +1729,8 @@ void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int
for (int l = 0; l < 16; l++)
RANDOMSCRAP(s, i);
spritesound(LASERTRIP_EXPLODE, i);
spawn(i, getspawn(i));
int sp = getspawn(i);
if (sp >= 0) spawn(i, sp);
ps[myconnectindex].actors_killed++;
deletesprite(i);
}

View file

@ -2644,7 +2644,13 @@ static void greenslime(int i)
}
}
void flamethrowerflame(int i)
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static void flamethrowerflame(int i)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
@ -2745,15 +2751,232 @@ void flamethrowerflame(int i)
//
//---------------------------------------------------------------------------
static void heavyhbomb(int i)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
int sect = s->sectnum;
int x, j, l;
if ((s->cstat & 32768))
{
t[2]--;
if (t[2] <= 0)
{
spritesound(TELEPORTER, i);
spawn(i, TRANSPORTERSTAR);
s->cstat = 257;
}
return;
}
int p = findplayer(s, &x);
if (x < 1220) s->cstat &= ~257;
else s->cstat |= 257;
if (t[3] == 0)
{
j = ifhitbyweapon(i);
if (j >= 0)
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
}
if (s->picnum != BOUNCEMINE)
{
makeitfall(i);
if (sector[sect].lotag != 1 && s->z >= hittype[i].floorz - (FOURSLEIGHT) && s->yvel < 3)
{
if (s->yvel > 0 || (s->yvel == 0 && hittype[i].floorz == sector[sect].floorz))
spritesound(PIPEBOMB_BOUNCE, i);
s->zvel = -((4 - s->yvel) << 8);
if (sector[s->sectnum].lotag == 2)
s->zvel >>= 2;
s->yvel++;
}
if (s->z < hittype[i].ceilingz) // && sector[sect].lotag != 2 )
{
s->z = hittype[i].ceilingz + (3 << 8);
s->zvel = 0;
}
}
j = movesprite(i,
(s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14,
(s->xvel * (sintable[s->ang & 2047])) >> 14,
s->zvel, CLIPMASK0);
if (sector[sprite[i].sectnum].lotag == 1 && s->zvel == 0)
{
s->z += (32 << 8);
if (t[5] == 0)
{
t[5] = 1;
spawn(i, WATERSPLASH2);
}
}
else t[5] = 0;
if (t[3] == 0 && (s->picnum == BOUNCEMINE || s->picnum == MORTER) && (j || x < 844))
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
if (sprite[s->owner].picnum == APLAYER)
l = sprite[s->owner].yvel;
else l = -1;
if (s->xvel > 0)
{
s->xvel -= 5;
if (sector[sect].lotag == 2)
s->xvel -= 10;
if (s->xvel < 0)
s->xvel = 0;
if (s->xvel & 8) s->cstat ^= 4;
}
if ((j & 49152) == 32768)
{
j &= (MAXWALLS - 1);
checkhitwall(i, j, s->x, s->y, s->z, s->picnum);
int k = getangle(
wall[wall[j].point2].x - wall[j].x,
wall[wall[j].point2].y - wall[j].y);
s->ang = ((k << 1) - s->ang) & 2047;
s->xvel >>= 1;
}
DETONATEB:
bool bBoom = false;
if ((l >= 0 && ps[l].hbomb_on == 0) || t[3] == 1)
bBoom = true;
if (isNamWW2GI() && s->picnum == HEAVYHBOMB)
{
s->extra--;
if (s->extra <= 0)
bBoom = true;
}
if (bBoom)
{
t[4]++;
if (t[4] == 2)
{
x = s->extra;
int m = 0;
switch (s->picnum)
{
case HEAVYHBOMB: m = pipebombblastradius; break;
case MORTER: m = morterblastradius; break;
case BOUNCEMINE: m = bouncemineblastradius; break;
}
hitradius(i, m, x >> 2, x >> 1, x - (x >> 2), x);
spawn(i, EXPLOSION2);
if (s->zvel == 0)
spawn(i, EXPLOSION2BOT);
spritesound(PIPEBOMB_EXPLODE, i);
for (x = 0; x < 8; x++)
RANDOMSCRAP(s, i);
}
if (s->yrepeat)
{
s->yrepeat = 0;
return;
}
if (t[4] > 20)
{
if (s->owner != i || ud.respawn_items == 0)
{
deletesprite(i);
return;
}
else
{
t[2] = respawnitemtime;
spawn(i, RESPAWNMARKERRED);
s->cstat = (short)32768;
s->yrepeat = 9;
return;
}
}
}
else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0)
if (cansee(s->x, s->y, s->z - (8 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
if (ps[p].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON])
{
if (ud.coop >= 1 && s->owner == i)
{
for (j = 0; j < ps[p].weapreccnt; j++)
if (ps[p].weaprecs[j] == s->picnum)
continue;
if (ps[p].weapreccnt < 255) // DukeGDX has 16 here.
ps[p].weaprecs[ps[p].weapreccnt++] = s->picnum;
}
addammo(HANDBOMB_WEAPON, &ps[p], 1);
spritesound(DUKE_GET, ps[p].i);
if (ps[p].gotweapon[HANDBOMB_WEAPON] == 0 || s->owner == ps[p].i)
addweapon(&ps[p], HANDBOMB_WEAPON);
if (sprite[s->owner].picnum != APLAYER)
{
SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0));
}
if (s->owner != i || ud.respawn_items == 0)
{
if (s->owner == i && ud.coop >= 1)
return;
deletesprite(i);
return;
}
else
{
t[2] = respawnitemtime;
spawn(i, RESPAWNMARKERRED);
s->cstat = (short)32768;
}
}
if (t[0] < 8) t[0]++;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void moveactors_d(void)
{
int x, m, l, * t;
int x, * t;
short j, sect, p;
spritetype* s;
unsigned short k;
int nexti;
bool bBoom;
for (int i = headspritestat[1]; i >= 0; i = nexti)
{
@ -2894,211 +3117,7 @@ void moveactors_d(void)
hittype[j].temp_data[0] = 3;
case HEAVYHBOMB:
if ((s->cstat & 32768))
{
t[2]--;
if (t[2] <= 0)
{
spritesound(TELEPORTER, i);
spawn(i, TRANSPORTERSTAR);
s->cstat = 257;
}
continue;
}
p = findplayer(s, &x);
if (x < 1220) s->cstat &= ~257;
else s->cstat |= 257;
if (t[3] == 0)
{
j = ifhitbyweapon(i);
if (j >= 0)
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
}
if (s->picnum != BOUNCEMINE)
{
makeitfall(i);
if (sector[sect].lotag != 1 && s->z >= hittype[i].floorz - (FOURSLEIGHT) && s->yvel < 3)
{
if (s->yvel > 0 || (s->yvel == 0 && hittype[i].floorz == sector[sect].floorz))
spritesound(PIPEBOMB_BOUNCE, i);
s->zvel = -((4 - s->yvel) << 8);
if (sector[s->sectnum].lotag == 2)
s->zvel >>= 2;
s->yvel++;
}
if (s->z < hittype[i].ceilingz) // && sector[sect].lotag != 2 )
{
s->z = hittype[i].ceilingz + (3 << 8);
s->zvel = 0;
}
}
j = movesprite(i,
(s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14,
(s->xvel * (sintable[s->ang & 2047])) >> 14,
s->zvel, CLIPMASK0);
if (sector[sprite[i].sectnum].lotag == 1 && s->zvel == 0)
{
s->z += (32 << 8);
if (t[5] == 0)
{
t[5] = 1;
spawn(i, WATERSPLASH2);
}
}
else t[5] = 0;
if (t[3] == 0 && (s->picnum == BOUNCEMINE || s->picnum == MORTER) && (j || x < 844))
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
if (sprite[s->owner].picnum == APLAYER)
l = sprite[s->owner].yvel;
else l = -1;
if (s->xvel > 0)
{
s->xvel -= 5;
if (sector[sect].lotag == 2)
s->xvel -= 10;
if (s->xvel < 0)
s->xvel = 0;
if (s->xvel & 8) s->cstat ^= 4;
}
if ((j & 49152) == 32768)
{
j &= (MAXWALLS - 1);
checkhitwall(i, j, s->x, s->y, s->z, s->picnum);
k = getangle(
wall[wall[j].point2].x - wall[j].x,
wall[wall[j].point2].y - wall[j].y);
s->ang = ((k << 1) - s->ang) & 2047;
s->xvel >>= 1;
}
DETONATEB:
bBoom = false;
if ((l >= 0 && ps[l].hbomb_on == 0) || t[3] == 1)
bBoom = true;
if (isNamWW2GI() && s->picnum == HEAVYHBOMB)
{
s->extra--;
if (s->extra <= 0)
bBoom = true;
}
if (bBoom)
{
t[4]++;
if (t[4] == 2)
{
x = s->extra;
m = 0;
switch (s->picnum)
{
case HEAVYHBOMB: m = pipebombblastradius; break;
case MORTER: m = morterblastradius; break;
case BOUNCEMINE: m = bouncemineblastradius; break;
}
hitradius(i, m, x >> 2, x >> 1, x - (x >> 2), x);
spawn(i, EXPLOSION2);
if (s->zvel == 0)
spawn(i, EXPLOSION2BOT);
spritesound(PIPEBOMB_EXPLODE, i);
for (x = 0; x < 8; x++)
RANDOMSCRAP(s, i);
}
if (s->yrepeat)
{
s->yrepeat = 0;
continue;
}
if (t[4] > 20)
{
if (s->owner != i || ud.respawn_items == 0)
{
deletesprite(i);
continue;
}
else
{
t[2] = respawnitemtime;
spawn(i, RESPAWNMARKERRED);
s->cstat = (short)32768;
s->yrepeat = 9;
continue;
}
}
}
else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0)
if (cansee(s->x, s->y, s->z - (8 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
if (ps[p].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON])
{
if (ud.coop >= 1 && s->owner == i)
{
for (j = 0; j < ps[p].weapreccnt; j++)
if (ps[p].weaprecs[j] == s->picnum)
goto BOLT;
if (ps[p].weapreccnt < 255) // DukeGDX has 16 here.
ps[p].weaprecs[ps[p].weapreccnt++] = s->picnum;
}
addammo(HANDBOMB_WEAPON, &ps[p], 1);
spritesound(DUKE_GET, ps[p].i);
if (ps[p].gotweapon[HANDBOMB_WEAPON] == 0 || s->owner == ps[p].i)
addweapon(&ps[p], HANDBOMB_WEAPON);
if (sprite[s->owner].picnum != APLAYER)
{
SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0));
}
if (s->owner != i || ud.respawn_items == 0)
{
if (s->owner == i && ud.coop >= 1)
continue;
deletesprite(i);
continue;
}
else
{
t[2] = respawnitemtime;
spawn(i, RESPAWNMARKERRED);
s->cstat = (short)32768;
}
}
if (t[0] < 8) t[0]++;
heavyhbomb(i);
continue;
case REACTORBURNT:
@ -3131,9 +3150,6 @@ void moveactors_d(void)
p = findplayer(s, &x);
execute(i, p, x);
BOLT:;
}
}

View file

@ -104,18 +104,18 @@ void addweapon_r(struct player_struct* p, int weapon)
if (p->OnMotorcycle || p->OnBoat)
{
p->gotweapon.Set(weapon);
if (weapon == SHRINKER_WEAPON)
if (weapon == THROWSAW_WEAPON)
{
p->gotweapon.Set(GROW_WEAPON);
p->ammo_amount[GROW_WEAPON] = 1;
p->gotweapon.Set(BUZZSAW_WEAPON);
p->ammo_amount[BUZZSAW_WEAPON] = 1;
}
else if (weapon == RPG_WEAPON)
else if (weapon == CROSSBOW_WEAPON)
{
p->gotweapon.Set(RA16_WEAPON);
p->gotweapon.Set(CHICKEN_WEAPON);
}
else if (weapon == RA15_WEAPON)
else if (weapon == SLINGBLADE_WEAPON)
{
p->ammo_amount[RA15_WEAPON] = 1;
p->ammo_amount[SLINGBLADE_WEAPON] = 1;
}
return;
}
@ -123,30 +123,30 @@ void addweapon_r(struct player_struct* p, int weapon)
if (p->gotweapon[weapon] == 0)
{
p->gotweapon.Set(weapon);
if (weapon == SHRINKER_WEAPON)
if (weapon == THROWSAW_WEAPON)
{
p->gotweapon.Set(GROW_WEAPON);
if (isRRRA()) p->ammo_amount[GROW_WEAPON] = 1;
p->gotweapon.Set(BUZZSAW_WEAPON);
if (isRRRA()) p->ammo_amount[BUZZSAW_WEAPON] = 1;
}
if (isRRRA())
{
if (weapon == RPG_WEAPON)
if (weapon == CROSSBOW_WEAPON)
{
p->gotweapon.Set(RA16_WEAPON);
p->gotweapon.Set(CHICKEN_WEAPON);
}
if (weapon == RA15_WEAPON)
if (weapon == SLINGBLADE_WEAPON)
{
p->ammo_amount[RA15_WEAPON] = 50;
p->ammo_amount[SLINGBLADE_WEAPON] = 50;
}
}
if (weapon != HANDBOMB_WEAPON)
if (weapon != DYNAMITE_WEAPON)
cw = weapon;
}
else
cw = weapon;
if (weapon == HANDBOMB_WEAPON)
if (weapon == DYNAMITE_WEAPON)
p->last_weapon = -1;
p->random_club_frame = 0;
@ -168,10 +168,10 @@ void addweapon_r(struct player_struct* p, int weapon)
switch (weapon)
{
case RA15_WEAPON:
case SLINGBLADE_WEAPON:
if (!isRRRA()) break;
case KNEE_WEAPON:
case HANDBOMB_WEAPON:
case DYNAMITE_WEAPON:
case TRIPBOMB_WEAPON:
case HANDREMOTE_WEAPON:
break;
@ -550,6 +550,7 @@ void movefta_r(void)
s = &sprite[i];
p = findplayer(s, &x);
j = 0;
ssect = psect = s->sectnum;
@ -630,7 +631,7 @@ void movefta_r(void)
else hittype[i].timetosleep = 0;
}
}
if (!j && badguy(s))
if (/*!j &&*/ badguy(s)) // this is like RedneckGDX. j is uninitialized here, i.e. most likely not 0.
{
if (sector[s->sectnum].ceilingstat & 1)
s->shade = sector[s->sectnum].ceilingshade;
@ -2647,12 +2648,338 @@ void rr_specialstats()
//
//---------------------------------------------------------------------------
static void heavyhbomb(int i)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
int sect = s->sectnum;
int x, j, l;
if ((s->cstat & 32768))
{
t[2]--;
if (t[2] <= 0)
{
spritesound(TELEPORTER, i);
spawn(i, TRANSPORTERSTAR);
s->cstat = 257;
}
return;
}
int p = findplayer(s, &x);
if (x < 1220) s->cstat &= ~257;
else s->cstat |= 257;
if (t[3] == 0)
{
j = ifhitbyweapon(i);
if (j >= 0)
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
}
makeitfall(i);
if (sector[sect].lotag != 1 && (!isRRRA() || sector[sect].lotag != 160) && s->z >= hittype[i].floorz - (FOURSLEIGHT) && s->yvel < 3)
{
if (s->yvel > 0 || (s->yvel == 0 && hittype[i].floorz == sector[sect].floorz))
{
if (s->picnum != CHEERBOMB)
spritesound(PIPEBOMB_BOUNCE, i);
else
{
t[3] = 1;
t[4] = 1;
l = 0;
goto DETONATEB;
}
}
s->zvel = -((4 - s->yvel) << 8);
if (sector[s->sectnum].lotag == 2)
s->zvel >>= 2;
s->yvel++;
}
if (s->picnum != CHEERBOMB && s->z < hittype[i].ceilingz + (16 << 8) && sector[sect].lotag != 2)
{
s->z = hittype[i].ceilingz + (16 << 8);
s->zvel = 0;
}
j = movesprite(i,
(s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14,
(s->xvel * (sintable[s->ang & 2047])) >> 14,
s->zvel, CLIPMASK0);
if (sector[sprite[i].sectnum].lotag == 1 && s->zvel == 0)
{
s->z += (32 << 8);
if (t[5] == 0)
{
t[5] = 1;
spawn(i, WATERSPLASH2);
if (isRRRA() && s->picnum == MORTER)
s->xvel = 0;
}
}
else t[5] = 0;
if (t[3] == 0 && s->picnum == MORTER && (j || x < 844))
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
if (t[3] == 0 && s->picnum == CHEERBOMB && (j || x < 844))
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
if (sprite[s->owner].picnum == APLAYER)
l = sprite[s->owner].yvel;
else l = -1;
if (s->xvel > 0)
{
s->xvel -= 5;
if (sector[sect].lotag == 2)
s->xvel -= 10;
if (s->xvel < 0)
s->xvel = 0;
if (s->xvel & 8) s->cstat ^= 4;
}
if ((j & 49152) == 32768)
{
j &= (MAXWALLS - 1);
checkhitwall(i, j, s->x, s->y, s->z, s->picnum);
int k = getangle(
wall[wall[j].point2].x - wall[j].x,
wall[wall[j].point2].y - wall[j].y);
if (s->picnum == CHEERBOMB)
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
s->ang = ((k << 1) - s->ang) & 2047;
s->xvel >>= 1;
}
DETONATEB:
if ((l >= 0 && ps[l].hbomb_on == 0) || t[3] == 1)
{
t[4]++;
if (t[4] == 2)
{
x = s->extra;
int m = 0;
switch (s->picnum)
{
case TRIPBOMBSPRITE: m = powderkegblastradius; break;
case HEAVYHBOMB: m = pipebombblastradius; break;
case HBOMBAMMO: m = pipebombblastradius; break;
case MORTER: m = morterblastradius; break;
case CHEERBOMB: m = morterblastradius; break;
}
if (sector[s->sectnum].lotag != 800)
{
hitradius(i, m, x >> 2, x >> 1, x - (x >> 2), x);
spawn(i, EXPLOSION2);
if (s->picnum == CHEERBOMB)
spawn(i, BURNING);
spritesound(PIPEBOMB_EXPLODE, i);
for (x = 0; x < 8; x++)
RANDOMSCRAP(s, i);
}
}
if (s->yrepeat)
{
s->yrepeat = 0;
return;
}
if (t[4] > 20)
{
deletesprite(i);
return;
}
if (s->picnum == CHEERBOMB)
{
spawn(i, BURNING);
deletesprite(i);
return;
}
}
else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0)
if (cansee(s->x, s->y, s->z - (8 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
if (ps[p].ammo_amount[DYNAMITE_WEAPON] < max_ammo_amount[DYNAMITE_WEAPON])
if (s->pal == 0)
{
if (ud.coop >= 1)
{
for (j = 0; j < ps[p].weapreccnt; j++)
if (ps[p].weaprecs[j] == i)
return;
if (ps[p].weapreccnt < 255)
ps[p].weaprecs[ps[p].weapreccnt++] = i;
}
addammo(DYNAMITE_WEAPON, &ps[p], 1);
addammo(CROSSBOW_WEAPON, &ps[p], 1);
spritesound(DUKE_GET, ps[p].i);
if (ps[p].gotweapon[DYNAMITE_WEAPON] == 0 || s->owner == ps[p].i)
addweapon(&ps[p], DYNAMITE_WEAPON);
if (sprite[s->owner].picnum != APLAYER)
{
SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0));
}
if (hittype[s->owner].picnum != HEAVYHBOMB || ud.respawn_items == 0 || sprite[s->owner].picnum == APLAYER)
{
if (s->picnum == HEAVYHBOMB &&
sprite[s->owner].picnum != APLAYER && ud.coop)
return;
deletesprite(i);
return;
}
else
{
t[2] = respawnitemtime;
spawn(i, RESPAWNMARKERRED);
s->cstat = (short)32768;
}
}
if (t[0] < 8) t[0]++;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static int henstand(int i)
{
spritetype* s = &sprite[i];
auto t = &hittype[i].temp_data[0];
int sect = s->sectnum;
int j;
if (s->picnum == HENSTAND || s->picnum == HENSTAND + 1)
{
s->lotag--;
if (s->lotag == 0)
{
spawn(i, HEN);
deletesprite(i);
return 1;
}
}
if (sector[s->sectnum].lotag == 900)
s->xvel = 0;
if (s->xvel)
{
makeitfall(i);
j = movesprite(i,
(sintable[(s->ang + 512) & 2047] * s->xvel) >> 14,
(sintable[s->ang & 2047] * s->xvel) >> 14,
s->zvel, CLIPMASK0);
if (j & 49152)
{
if ((j & 49152) == 32768)
{
j &= (MAXWALLS - 1);
int k = getangle(
wall[wall[j].point2].x - wall[j].x,
wall[wall[j].point2].y - wall[j].y);
s->ang = ((k << 1) - s->ang) & 2047;
}
else if ((j & 49152) == 49152)
{
j &= (MAXSPRITES - 1);
checkhitsprite(i, j);
if (sprite[j].picnum == HEN)
{
int ns = spawn(j, HENSTAND);
deletesprite(j);
sprite[ns].xvel = 32;
sprite[ns].lotag = 40;
sprite[ns].ang = s->ang;
}
}
}
s->xvel--;
if (s->xvel < 0) s->xvel = 0;
s->cstat = 257;
if (s->picnum == RRTILE3440)
{
s->cstat |= 4 & s->xvel;
s->cstat |= 8 & s->xvel;
if (krand() & 1)
s->picnum = RRTILE3440 + 1;
}
else if (s->picnum == HENSTAND)
{
s->cstat |= 4 & s->xvel;
s->cstat |= 8 & s->xvel;
if (krand() & 1)
s->picnum = HENSTAND + 1;
if (!s->xvel)
return 2;//deletesprite(i); still needs to run a script but should not do on a deleted object
}
if (s->picnum == RRTILE3440 || (s->picnum == RRTILE3440 + 1 && !s->xvel))
{
return 2;//deletesprite(i); still needs to run a script but should not do on a deleted object
}
}
else if (sector[s->sectnum].lotag == 900)
{
if (s->picnum == BOWLINGBALL)
ballreturn(i);
deletesprite(i);
return 1;
}
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void moveactors_r(void)
{
int x, m, l, nexti;
short j, ns, sect, p;
int x, nexti;
int j, sect, p;
spritetype *s;
unsigned short k;
dojaildoor();
moveminecart();
@ -2666,6 +2993,7 @@ void moveactors_r(void)
for (int i = headspritestat[1]; i >= 0; i = nexti)
{
nexti = nextspritestat[i];
bool deleteafterexecute = false; // taking a cue here from RedNukem to not run scripts on deleted sprites.
s = &sprite[i];
@ -2811,82 +3139,12 @@ void moveactors_r(void)
case RRTILE3440+1:
case HENSTAND:
case HENSTAND+1:
if (s->picnum == HENSTAND || s->picnum == HENSTAND+1)
{
s->lotag--;
if (s->lotag == 0)
{
spawn(i,HEN);
deletesprite(i);
continue;
}
}
if (sector[s->sectnum].lotag == 900)
s->xvel = 0;
if (s->xvel)
{
makeitfall(i);
j = movesprite(i,
(sintable[(s->ang+512)&2047]*s->xvel)>>14,
(sintable[s->ang&2047]*s->xvel)>>14,
s->zvel,CLIPMASK0);
if (j & 49152)
{
if ((j & 49152) == 32768)
{
j &= (MAXWALLS-1);
k = getangle(
wall[wall[j].point2].x-wall[j].x,
wall[wall[j].point2].y-wall[j].y);
s->ang = ((k<<1) - s->ang)&2047;
}
else if ((j & 49152) == 49152)
{
j &= (MAXSPRITES-1);
checkhitsprite(i,j);
if (sprite[j].picnum == HEN)
{
ns = spawn(j,HENSTAND);
deletesprite(j);
sprite[ns].xvel = 32;
sprite[ns].lotag = 40;
sprite[ns].ang = s->ang;
}
}
}
s->xvel --;
if(s->xvel < 0) s->xvel = 0;
s->cstat = 257;
if( s->picnum == RRTILE3440 )
{
s->cstat |= 4&s->xvel;
s->cstat |= 8&s->xvel;
if (krand() & 1)
s->picnum = RRTILE3440+1;
}
else if (s->picnum == HENSTAND)
{
s->cstat |= 4&s->xvel;
s->cstat |= 8&s->xvel;
if (krand() & 1)
s->picnum = HENSTAND+1;
if (!s->xvel)
deletesprite(i);
}
if (s->picnum == RRTILE3440 || (s->picnum == RRTILE3440 + 1 && !s->xvel))
{
deletesprite(i);
continue;
}
}
else if (sector[s->sectnum].lotag == 900)
{
if (s->picnum == BOWLINGBALL)
ballreturn(i);
deletesprite(i);
continue;
}
{
int todo = henstand(i);
if (todo == 2) deleteafterexecute = true;
if (todo == 1) continue;
break;
}
case QUEBALL:
case STRIPEBALL:
@ -2915,8 +3173,9 @@ void moveactors_r(void)
return COW;
else if (s->picnum == UFO4)
return PIG;
else //if (s->picnum == UFO5)
else if (s->picnum == UFO5)
return BILLYRAY;
else return -1;
});
continue;
@ -2956,229 +3215,7 @@ void moveactors_r(void)
if (!isRRRA()) break;
case MORTER:
case HEAVYHBOMB:
if( (s->cstat&32768) )
{
t[2]--;
if(t[2] <= 0)
{
spritesound(TELEPORTER,i);
spawn(i,TRANSPORTERSTAR);
s->cstat = 257;
}
continue;
}
p = findplayer(s,&x);
if( x < 1220 ) s->cstat &= ~257;
else s->cstat |= 257;
if(t[3] == 0 )
{
j = ifhitbyweapon(i);
if(j >= 0)
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
}
makeitfall(i);
if( sector[sect].lotag != 1 && (!isRRRA() || sector[sect].lotag != 160) && s->z >= hittype[i].floorz-(FOURSLEIGHT) && s->yvel < 3 )
{
if( s->yvel > 0 || (s->yvel == 0 && hittype[i].floorz == sector[sect].floorz ))
{
if (s->picnum != CHEERBOMB)
spritesound(PIPEBOMB_BOUNCE,i);
else
{
t[3] = 1;
t[4] = 1;
l = 0;
goto DETONATEB;
}
}
s->zvel = -((4-s->yvel)<<8);
if(sector[s->sectnum].lotag== 2)
s->zvel >>= 2;
s->yvel++;
}
if(s->picnum != CHEERBOMB && s->z < hittype[i].ceilingz+(16<<8) && sector[sect].lotag != 2 )
{
s->z = hittype[i].ceilingz+(16<<8);
s->zvel = 0;
}
j = movesprite(i,
(s->xvel*(sintable[(s->ang+512)&2047]))>>14,
(s->xvel*(sintable[s->ang&2047]))>>14,
s->zvel,CLIPMASK0);
if(sector[sprite[i].sectnum].lotag == 1 && s->zvel == 0)
{
s->z += (32<<8);
if(t[5] == 0)
{
t[5] = 1;
spawn(i,WATERSPLASH2);
if (isRRRA() && s->picnum == MORTER)
s->xvel = 0;
}
}
else t[5] = 0;
if(t[3] == 0 && s->picnum == MORTER && (j || x < 844) )
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
if(t[3] == 0 && s->picnum == CHEERBOMB && (j || x < 844) )
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
if(sprite[s->owner].picnum == APLAYER)
l = sprite[s->owner].yvel;
else l = -1;
if(s->xvel > 0)
{
s->xvel -= 5;
if(sector[sect].lotag == 2)
s->xvel -= 10;
if(s->xvel < 0)
s->xvel = 0;
if(s->xvel&8) s->cstat ^= 4;
}
if( (j&49152) == 32768 )
{
j &= (MAXWALLS-1);
checkhitwall(i,j,s->x,s->y,s->z,s->picnum);
k = getangle(
wall[wall[j].point2].x-wall[j].x,
wall[wall[j].point2].y-wall[j].y);
if (s->picnum == CHEERBOMB)
{
t[3] = 1;
t[4] = 0;
l = 0;
s->xvel = 0;
goto DETONATEB;
}
s->ang = ((k<<1) - s->ang)&2047;
s->xvel >>= 1;
}
DETONATEB:
if( ( l >= 0 && ps[l].hbomb_on == 0 ) || t[3] == 1)
{
t[4]++;
if(t[4] == 2)
{
x = s->extra;
m = 0;
switch(s->picnum)
{
case TRIPBOMBSPRITE: m = powderkegblastradius;break;
case HEAVYHBOMB: m = pipebombblastradius;break;
case HBOMBAMMO: m = pipebombblastradius;break;
case MORTER: m = morterblastradius;break;
case CHEERBOMB: m = morterblastradius;break;
}
if(sector[s->sectnum].lotag != 800)
{
hitradius( i, m,x>>2,x>>1,x-(x>>2),x);
spawn(i,EXPLOSION2);
if (s->picnum == CHEERBOMB)
spawn(i,BURNING);
spritesound(PIPEBOMB_EXPLODE,i);
for(x=0;x<8;x++)
RANDOMSCRAP(s, i);
}
}
if(s->yrepeat)
{
s->yrepeat = 0;
continue;
}
if(t[4] > 20)
{
deletesprite(i);
continue;
}
if (s->picnum == CHEERBOMB)
{
spawn(i,BURNING);
deletesprite(i);
continue;
}
}
else if(s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0)
if( cansee(s->x,s->y,s->z-(8<<8),s->sectnum,ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum) )
if(ps[p].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON])
if(s->pal == 0)
{
if(ud.coop >= 1)
{
for(j=0;j<ps[p].weapreccnt;j++)
if(ps[p].weaprecs[j] == i)
continue;
if(ps[p].weapreccnt < 255)
ps[p].weaprecs[ps[p].weapreccnt++] = i;
}
addammo(HANDBOMB_WEAPON,&ps[p],1);
addammo(RPG_WEAPON,&ps[p],1);
spritesound(DUKE_GET,ps[p].i);
if( ps[p].gotweapon[HANDBOMB_WEAPON] == 0 || s->owner == ps[p].i )
addweapon(&ps[p],HANDBOMB_WEAPON);
if( sprite[s->owner].picnum != APLAYER )
{
SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0));
}
if( hittype[s->owner].picnum != HEAVYHBOMB || ud.respawn_items == 0 || sprite[s->owner].picnum == APLAYER )
{
if(s->picnum == HEAVYHBOMB &&
sprite[s->owner].picnum != APLAYER && ud.coop )
continue;
deletesprite(i);
continue;
}
else
{
t[2] = respawnitemtime;
spawn(i,RESPAWNMARKERRED);
s->cstat = (short) 32768;
}
}
if(t[0] < 8) t[0]++;
heavyhbomb(i);
continue;
case REACTORBURNT:
@ -3211,7 +3248,7 @@ void moveactors_r(void)
p = findplayer(s,&x);
execute(i,p,x);
i = nexti;
if (deleteafterexecute) deletesprite(i);
}
}

View file

@ -2850,6 +2850,8 @@ void VM_UpdateAnim(int spriteNum, int32_t *pData)
// NORECURSE
void A_Execute(int spriteNum, int playerNum, int playerDist)
{
if (!G_HaveActor(sprite[spriteNum].picnum)) return;
vmstate_t tempvm
= { spriteNum, playerNum, playerDist, 0, &sprite[spriteNum], &actor[spriteNum].t_data[0], g_player[playerNum].ps, &actor[spriteNum] };
vm = tempvm;

View file

@ -2929,8 +2929,19 @@ void G_InitDynamicTiles(void)
int32_t i;
// this cannot include the constant headers so it has to use literal numbers
APLAYER = (g_gameType & GAMEFLAG_RRALL) ? 3845 : 1405;
CAMERA1 = (g_gameType & GAMEFLAG_RRALL) ? 1134 : 621;
// Not sure yet about the weapons - this should probably be done by using the real RR constants where applicable
if (!isRR())
{
APLAYER = 3845;
CAMERA1 = 1134;
}
else
{
APLAYER = 1405;
CAMERA1 = 621;
}
Bmemset(DynamicTileMap, 0, sizeof(DynamicTileMap));

View file

@ -3585,18 +3585,15 @@ enum dukeweapon_t_alt
FREEZE_WEAPON,
HANDREMOTE_WEAPON, // 10
GROW_WEAPON,
BOWLINGBALL_WEAPON,
MOTORCYCLE_WEAPON,
BOAT_WEAPON,
SLINGBLADE_WEAPON, // 15
CHICKEN_WEAPON,
RA15_WEAPON = 15, // 15
RA16_WEAPON,
MIN_WEAPON = 0,
MAX_WEAPON = 9
};
enum redneck_weapon_t
{
// RR names from RedneckGDX. The reconstructed source uses the Duke names.
// These names have been pieced together from RedneckGDX and RedNukem because the reconstructed source recycled Duke's names for the first 11 weapons.
// Names for 0-2 are the same
RIFLEGUN_WEAPON = 3,
DYNAMITE_WEAPON = 4,
CROSSBOW_WEAPON = 5,
@ -3605,13 +3602,14 @@ enum redneck_weapon_t
POWDERKEG_WEAPON = 8,
TIT_WEAPON = 9,
//HANDREMOTE_WEAPON = 10;
BUZSAW_WEAPON = 11,
BUZZSAW_WEAPON = 11,
BOWLING_WEAPON = 12,
MOTO_WEAPON = 13,
//BOAT_WEAPON = 14,
RATE_WEAPON = 15,
CHICKENBOW_WEAPON = 16
MOTORCYCLE_WEAPON = 13,
BOAT_WEAPON = 14,
SLINGBLADE_WEAPON = 15,
CHICKEN_WEAPON = 16,
};
extern int APLAYER, CAMERA1;
#define DYNAMICWEAPONMAP(Weaponnum) Weaponnum

View file

@ -2137,9 +2137,9 @@ void P_DisplayWeapon(void)
weaponX += 8;
weaponYOffset -= 10;
if (currentWeapon == BOWLINGBALL_WEAPON)
if (currentWeapon == BOWLING_WEAPON)
{
if (pPlayer->ammo_amount[BOWLINGBALL_WEAPON])
if (pPlayer->ammo_amount[BOWLING_WEAPON])
{
G_DrawWeaponTileWithID(currentWeapon, weaponX + 162 - halfLookAng, weaponY + 214 - weaponYOffset + (*weaponFrame) * 8, TILE_BOWLINGBALLH,
weaponShade, weaponBits, weaponPal, 32768);
@ -5064,7 +5064,7 @@ static void P_ProcessWeapon(int playerNum)
#undef WEAPON2_CLIP
if (WW2GI ? PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_GLOWS :
(pPlayer->curr_weapon == SHRINKER_WEAPON || pPlayer->curr_weapon == GROW_WEAPON
|| (RR && (pPlayer->curr_weapon == TRIPBOMB_WEAPON || pPlayer->curr_weapon == BOWLINGBALL_WEAPON))
|| (RR && (pPlayer->curr_weapon == TRIPBOMB_WEAPON || pPlayer->curr_weapon == BOWLING_WEAPON))
|| (RRRA && (pPlayer->curr_weapon == KNEE_WEAPON || pPlayer->curr_weapon == SLINGBLADE_WEAPON))))
{
pPlayer->random_club_frame += 64; // Glowing
@ -5325,7 +5325,7 @@ static void P_ProcessWeapon(int playerNum)
if (++(*weaponFrame) > 19)
{
*weaponFrame = 0;
pPlayer->curr_weapon = HANDREMOTE_WEAPON;
pPlayer->curr_weapon = DYNAMITE_WEAPON;
pPlayer->last_weapon = -1;
pPlayer->weapon_pos = WEAPON_POS_RAISE;
pPlayer->hbomb_time = 45;
@ -5348,9 +5348,9 @@ static void P_ProcessWeapon(int playerNum)
}
if ((*weaponFrame) == 12)
{
pPlayer->ammo_amount[HANDBOMB_WEAPON]--;
if (pPlayer->ammo_amount[RPG_WEAPON])
pPlayer->ammo_amount[RPG_WEAPON]--;
pPlayer->ammo_amount[DYNAMITE_WEAPON]--;
if (pPlayer->ammo_amount[CROSSBOW_WEAPON])
pPlayer->ammo_amount[CROSSBOW_WEAPON]--;
//if (numplayers < 2 || g_netServer)
{
@ -5808,7 +5808,7 @@ static void P_ProcessWeapon(int playerNum)
case BOWLINGBALL_WEAPON__STATIC:
if ((*weaponFrame) == 30)
{
pPlayer->ammo_amount[BOWLINGBALL_WEAPON]--;
pPlayer->ammo_amount[BOWLING_WEAPON]--;
A_PlaySound(354, pPlayer->i);
A_Shoot(pPlayer->i, TILE_BOWLINGBALL);
pPlayer->noise_radius = 1024;
@ -5820,7 +5820,7 @@ static void P_ProcessWeapon(int playerNum)
if ((*weaponFrame) > 40)
{
(*weaponFrame) = 0;
pPlayer->gotweapon.Clear(BOWLINGBALL_WEAPON);
pPlayer->gotweapon.Clear(BOWLING_WEAPON);
P_CheckWeapon(pPlayer);
}
break;
@ -5863,9 +5863,9 @@ static void P_ProcessWeapon(int playerNum)
case RPG_WEAPON__STATIC:
if (++(*weaponFrame) == 4)
{
pPlayer->ammo_amount[RPG_WEAPON]--;
if (pPlayer->ammo_amount[HANDBOMB_WEAPON])
pPlayer->ammo_amount[HANDBOMB_WEAPON]--;
pPlayer->ammo_amount[CROSSBOW_WEAPON]--;
if (pPlayer->ammo_amount[DYNAMITE_WEAPON])
pPlayer->ammo_amount[DYNAMITE_WEAPON]--;
lastvisinc = (int32_t) totalclock + 32;
pPlayer->visibility = 0;
flashColor = 255+(95<<8);

View file

@ -1177,7 +1177,7 @@ static void resetprestat(int playerNum, int gameMode)
P_ResetWeapons(playerNum);
P_ResetInventory(playerNum);
}
else if (pPlayer->curr_weapon == HANDREMOTE_WEAPON)
else if (pPlayer->curr_weapon == HANDREMOTE_WEAPON && !isRR())
{
pPlayer->ammo_amount[HANDBOMB_WEAPON]++;
pPlayer->curr_weapon = HANDBOMB_WEAPON;

View file

@ -497,7 +497,7 @@ public:
}
int weapon = p->curr_weapon;
if (weapon == HANDREMOTE_WEAPON) weapon = HANDBOMB_WEAPON;
if (weapon == HANDREMOTE_WEAPON) weapon = DYNAMITE_WEAPON;
if (p->curr_weapon != KNEE_WEAPON && p->curr_weapon != SLINGBLADE_WEAPON && (!althud_flashing || (int32_t)totalclock & 32 || p->ammo_amount[weapon] > (p->max_ammo_amount[weapon] / 10)))
{
@ -551,7 +551,7 @@ public:
// ammo
//
DrawGraphic(tileGetTexture(TILE_AMMOBOX), 41, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? HANDBOMB_WEAPON : p->curr_weapon;
int wp = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wp]);
SBar_DrawString(this, &digiFont, format, 57, -digiFont.mFont->GetHeight() * scale - 7, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
@ -679,7 +679,7 @@ public:
//==========================================================================
//
// Weapon display
// Weapon display (Duke only)
//
//==========================================================================
@ -843,7 +843,7 @@ public:
if (p->curr_weapon != KNEE_WEAPON)
{
int wep = (p->curr_weapon == HANDREMOTE_WEAPON) ? HANDBOMB_WEAPON : p->curr_weapon;
int wep = (p->curr_weapon == HANDREMOTE_WEAPON) ? DYNAMITE_WEAPON : p->curr_weapon;
format.Format("%d", p->ammo_amount[wep]);
SBar_DrawString(this, &digiFont, format, 107, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
}

View file

@ -3794,7 +3794,7 @@ CHECKINV1:
if (RRRA)
{
if (currentWeapon == CHICKEN_WEAPON) currentWeapon = RPG_WEAPON;
if (currentWeapon == CHICKEN_WEAPON) currentWeapon = CROSSBOW_WEAPON;
else if (currentWeapon == GROW_WEAPON) currentWeapon = SHRINKER_WEAPON;
else if (currentWeapon == SLINGBLADE_WEAPON) currentWeapon = KNEE_WEAPON;
}
@ -3823,7 +3823,7 @@ CHECKINV1:
else
currentWeapon += weaponNum;
if (currentWeapon == -1) currentWeapon = FREEZE_WEAPON;
if (currentWeapon == -1) currentWeapon = TIT_WEAPON;
else if (currentWeapon == 10) currentWeapon = KNEE_WEAPON;
if ((pPlayer->gotweapon[currentWeapon]) && pPlayer->ammo_amount[currentWeapon] > 0)
@ -3889,11 +3889,11 @@ CHECKINV1:
weaponNum = KNEE_WEAPON;
}
}
else if (weaponNum == RPG_WEAPON)
else if (weaponNum == CROSSBOW_WEAPON)
{
if(screenpeek == playerNum) pus = NUMPAGES;
if (pPlayer->curr_weapon == RPG_WEAPON || pPlayer->ammo_amount[RPG_WEAPON] == 0)
if (pPlayer->curr_weapon == CROSSBOW_WEAPON || pPlayer->ammo_amount[CROSSBOW_WEAPON] == 0)
{
if (pPlayer->ammo_amount[CHICKEN_WEAPON] == 0)
return;
@ -3903,7 +3903,7 @@ CHECKINV1:
else if((pPlayer->subweapon&4) || pPlayer->ammo_amount[CHICKEN_WEAPON] == 0)
{
pPlayer->subweapon = 0;
weaponNum = RPG_WEAPON;
weaponNum = CROSSBOW_WEAPON;
}
}
}
@ -3930,10 +3930,10 @@ CHECKINV1:
if (pPlayer->curr_weapon == TRIPBOMB_WEAPON || pPlayer->ammo_amount[TRIPBOMB_WEAPON] == 0)
{
pPlayer->subweapon = (1<<BOWLINGBALL_WEAPON);
weaponNum = BOWLINGBALL_WEAPON;
pPlayer->subweapon = (1<<BOWLING_WEAPON);
weaponNum = BOWLING_WEAPON;
}
else if((pPlayer->subweapon&(1<<BOWLINGBALL_WEAPON)) || pPlayer->ammo_amount[BOWLINGBALL_WEAPON] == 0)
else if((pPlayer->subweapon&(1<<BOWLING_WEAPON)) || pPlayer->ammo_amount[BOWLING_WEAPON] == 0)
{
pPlayer->subweapon = 0;
weaponNum = TRIPBOMB_WEAPON;