mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 20:40:47 +00:00
- pass spawner as an actor pointer to 'lotsofstuff'.
Allows doing this without using sprite indices.
This commit is contained in:
parent
a5b3681630
commit
34e39dd221
12 changed files with 40 additions and 35 deletions
|
@ -258,15 +258,15 @@ void insertspriteq(int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void lotsofstuff(spritetype* s, short n, int spawntype)
|
||||
void lotsofstuff(DDukeActor* actor, int n, int spawntype)
|
||||
{
|
||||
short i, j;
|
||||
for (i = n; i > 0; i--)
|
||||
auto s = &actor->s;
|
||||
for (int i = n; i > 0; i--)
|
||||
{
|
||||
short r1 = krand(), r2 = krand(); // using the RANDCORRECT version from RR.
|
||||
int r1 = krand(), r2 = krand(); // using the RANDCORRECT version from RR.
|
||||
// TRANSITIONAL RedNukem sets the spawner as owner.
|
||||
j = EGS(s->sectnum, s->x, s->y, s->z - (r2 % (47 << 8)), spawntype, -32, 8, 8, r1 & 2047, 0, 0, (short)0, 5);
|
||||
sprite[j].cstat = krand() & 12;
|
||||
auto j = EGS(s->sectnum, s->x, s->y, s->z - (r2 % (47 << 8)), spawntype, -32, 8, 8, r1 & 2047, 0, 0, actor, 5);
|
||||
j->s.cstat = krand() & 12;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -630,19 +630,19 @@ int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, un
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void lotsofmoney_d(spritetype *s, short n)
|
||||
void lotsofmoney_d(DDukeActor *actor, short n)
|
||||
{
|
||||
lotsofstuff(s, n, MONEY);
|
||||
lotsofstuff(actor, n, MONEY);
|
||||
}
|
||||
|
||||
void lotsofmail_d(spritetype *s, short n)
|
||||
void lotsofmail_d(DDukeActor *actor, short n)
|
||||
{
|
||||
lotsofstuff(s, n, MAIL);
|
||||
lotsofstuff(actor, n, MAIL);
|
||||
}
|
||||
|
||||
void lotsofpaper_d(spritetype *s, short n)
|
||||
void lotsofpaper_d(DDukeActor *actor, short n)
|
||||
{
|
||||
lotsofstuff(s, n, PAPER);
|
||||
lotsofstuff(actor, n, PAPER);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -453,9 +453,9 @@ int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, un
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void lotsoffeathers_r(spritetype *s, short n)
|
||||
void lotsoffeathers_r(DDukeActor *actor, short n)
|
||||
{
|
||||
lotsofstuff(s, n, MONEY);
|
||||
lotsofstuff(actor, n, MONEY);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2468,7 +2468,7 @@ void rr_specialstats()
|
|||
s->lotag--;
|
||||
if (s->lotag < 0)
|
||||
{
|
||||
lotsoffeathers_r(&sprite[i], (krand() & 3) + 4);
|
||||
lotsoffeathers_r(&hittype[i], (krand() & 3) + 4);
|
||||
s->lotag = 84;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -66,10 +66,10 @@ void addweapon_d(struct player_struct* p, int weapon);
|
|||
void addweapon_r(struct player_struct* p, int weapon);
|
||||
void hitradius_d(short i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
void hitradius_r(short i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
void lotsofmoney_d(spritetype* s, short n);
|
||||
void lotsofmail_d(spritetype* s, short n);
|
||||
void lotsofpaper_d(spritetype* s, short n);
|
||||
void lotsoffeathers_r(spritetype* s, short n);
|
||||
void lotsofmoney_d(DDukeActor* s, short n);
|
||||
void lotsofmail_d(DDukeActor* s, short n);
|
||||
void lotsofpaper_d(DDukeActor* s, short n);
|
||||
void lotsoffeathers_r(DDukeActor* s, short n);
|
||||
void guts_d(spritetype* s, short gtype, short n, short p);
|
||||
void guts_r(spritetype* s, short gtype, short n, short p);
|
||||
void gutsdir_d(spritetype* s, short gtype, short n, short p);
|
||||
|
|
|
@ -89,9 +89,9 @@ struct Dispatcher
|
|||
void (*addweapon)(struct player_struct *p, int weapon);
|
||||
void (*hitradius)(short i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
int (*movesprite)(int spritenum, int xchange, int ychange, int zchange, unsigned int cliptype);
|
||||
void (*lotsofmoney)(spritetype *s, short n);
|
||||
void (*lotsofmail)(spritetype *s, short n);
|
||||
void (*lotsofpaper)(spritetype *s, short n);
|
||||
void (*lotsofmoney)(DDukeActor *s, short n);
|
||||
void (*lotsofmail)(DDukeActor *s, short n);
|
||||
void (*lotsofpaper)(DDukeActor *s, short n);
|
||||
void (*guts)(spritetype* s, short gtype, short n, short p);
|
||||
void (*gutsdir)(spritetype* s, short gtype, short n, short p);
|
||||
int (*ifhitsectors)(int sectnum);
|
||||
|
|
|
@ -44,7 +44,7 @@ void bounce(int i);
|
|||
void movetongue(int i, int tongue, int jaw);
|
||||
void rpgexplode(int i, int j, const vec3_t& pos, int EXPLOSION2, int newextra, int playsound);
|
||||
void moveooz(int i, int seenine, int seeninedead, int ooz, int explosion);
|
||||
void lotsofstuff(spritetype* s, short n, int spawntype);
|
||||
void lotsofstuff(DDukeActor* s, int n, int spawntype);
|
||||
bool respawnmarker(int i, int yellow, int green);
|
||||
bool rat(int i, bool makesound);
|
||||
bool queball(int i, int pocket, int queball, int stripeball);
|
||||
|
|
|
@ -73,6 +73,7 @@ struct ParseState
|
|||
int* g_t;
|
||||
uint8_t killit_flag;
|
||||
spritetype* g_sp;
|
||||
DDukeActor *g_ac;
|
||||
int* insptr;
|
||||
|
||||
int parse(void);
|
||||
|
@ -1888,12 +1889,12 @@ int ParseState::parse(void)
|
|||
break;
|
||||
case concmd_money:
|
||||
insptr++;
|
||||
fi.lotsofmoney(g_sp,*insptr);
|
||||
fi.lotsofmoney(g_ac,*insptr);
|
||||
insptr++;
|
||||
break;
|
||||
case concmd_mail:
|
||||
insptr++;
|
||||
fi.lotsofmail(g_sp,*insptr);
|
||||
fi.lotsofmail(g_ac,*insptr);
|
||||
insptr++;
|
||||
break;
|
||||
case concmd_sleeptime:
|
||||
|
@ -1903,7 +1904,7 @@ int ParseState::parse(void)
|
|||
break;
|
||||
case concmd_paper:
|
||||
insptr++;
|
||||
fi.lotsofpaper(g_sp,*insptr);
|
||||
fi.lotsofpaper(g_ac,*insptr);
|
||||
insptr++;
|
||||
break;
|
||||
case concmd_addkills:
|
||||
|
@ -3674,6 +3675,7 @@ void LoadActor(int i, int p, int x)
|
|||
s.g_x = x; // ??
|
||||
g_sp = s.g_sp = &sprite[i]; // Pointer to sprite structure
|
||||
s.g_t = &hittype[i].temp_data[0]; // Sprite's 'extra' data
|
||||
s.g_ac = &hittype[i];
|
||||
|
||||
auto addr = tileinfo[s.g_sp->picnum].loadeventscriptptr;
|
||||
if (addr == 0) return;
|
||||
|
@ -3767,6 +3769,7 @@ void execute(int i,int p,int x)
|
|||
s.g_x = x; // ??
|
||||
g_sp = s.g_sp = &sprite[i]; // Pointer to sprite structure
|
||||
s.g_t = &hittype[i].temp_data[0]; // Sprite's 'extra' data
|
||||
s.g_ac = &hittype[i];
|
||||
|
||||
if (actorinfo[g_sp->picnum].scriptaddress == 0) return;
|
||||
s.insptr = &ScriptCode[4 + (actorinfo[g_sp->picnum].scriptaddress)];
|
||||
|
@ -3864,6 +3867,7 @@ void OnEvent(int iEventID, int p, int i, int x)
|
|||
s.g_p = p; /// current player ID
|
||||
s.g_x = x; // ?
|
||||
s.g_sp = &sprite[i];
|
||||
s.g_ac = &hittype[i];
|
||||
s.g_t = &hittype[i].temp_data[0];
|
||||
|
||||
s.insptr = &ScriptCode[apScriptGameEvent[iEventID]];
|
||||
|
|
|
@ -696,7 +696,7 @@ static void shootrpg(int i, int p, int sx, int sy, int sz, int sa, int atwith)
|
|||
{
|
||||
sprite[j].lotag = var90;
|
||||
sprite[j].hitag = 0;
|
||||
fi.lotsofmoney(&sprite[j], (krand() & 3) + 1);
|
||||
fi.lotsofmoney(&hittype[j], (krand() & 3) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ source as it is released.
|
|||
#include "ns.h"
|
||||
#include "global.h"
|
||||
#include "sounds.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
using std::min;
|
||||
using std::max;
|
||||
|
|
|
@ -816,7 +816,7 @@ void checkhitwall_d(int spr, int dawallnum, int x, int y, int z, int atwith)
|
|||
|
||||
case ATM:
|
||||
wal->picnum = ATMBROKE;
|
||||
fi.lotsofmoney(&sprite[spr], 1 + (krand() & 7));
|
||||
fi.lotsofmoney(&hittype[spr], 1 + (krand() & 7));
|
||||
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
|
||||
break;
|
||||
|
||||
|
@ -1183,7 +1183,7 @@ void checkhitsprite_d(int i, int sn)
|
|||
case STATUEFLASH:
|
||||
case STATUE:
|
||||
if (s->picnum == BOTTLE10)
|
||||
fi.lotsofmoney(&sprite[i], 4 + (krand() & 3));
|
||||
fi.lotsofmoney(&hittype[i], 4 + (krand() & 3));
|
||||
else if (s->picnum == STATUE || s->picnum == STATUEFLASH)
|
||||
{
|
||||
lotsofcolourglass(i, -1, 40);
|
||||
|
@ -1526,7 +1526,7 @@ void checksectors_d(int snum)
|
|||
if (chatmodeon || sprite[p->i].extra <= 0) return;
|
||||
|
||||
if (ud.cashman && PlayerInput(snum, SB_OPEN))
|
||||
fi.lotsofmoney(&sprite[p->i], 2);
|
||||
fi.lotsofmoney(&hittype[p->i], 2);
|
||||
|
||||
if (p->newowner >= 0)
|
||||
{
|
||||
|
|
|
@ -1245,7 +1245,7 @@ void checkhitwall_r(int spr, int dawallnum, int x, int y, int z, int atwith)
|
|||
|
||||
case ATM:
|
||||
wal->picnum = ATMBROKE;
|
||||
fi.lotsofmoney(&sprite[spr], 1 + (krand() & 7));
|
||||
fi.lotsofmoney(&hittype[spr], 1 + (krand() & 7));
|
||||
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
|
||||
break;
|
||||
|
||||
|
@ -2220,7 +2220,7 @@ void checkhitsprite_r(int i, int sn)
|
|||
case STATUEFLASH:
|
||||
case STATUE:
|
||||
if (s->picnum == BOTTLE10)
|
||||
fi.lotsofmoney(&sprite[i], 4 + (krand() & 3));
|
||||
fi.lotsofmoney(&hittype[i], 4 + (krand() & 3));
|
||||
else if (s->picnum == STATUE || s->picnum == STATUEFLASH)
|
||||
{
|
||||
lotsofcolourglass(i, -1, 40);
|
||||
|
@ -2468,7 +2468,7 @@ void checksectors_r(int snum)
|
|||
if (chatmodeon || sprite[p->i].extra <= 0) return;
|
||||
|
||||
if (ud.cashman && PlayerInput(snum, SB_OPEN))
|
||||
fi.lotsofmoney(&sprite[p->i], 2);
|
||||
fi.lotsofmoney(&hittype[p->i], 2);
|
||||
|
||||
|
||||
if (!(PlayerInput(snum, SB_OPEN)))
|
||||
|
|
|
@ -49,8 +49,8 @@ BEGIN_DUKE_NS
|
|||
|
||||
short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, short s_ow, signed char s_ss)
|
||||
{
|
||||
if (isRRRA() && s_ow < 0)
|
||||
return 0;
|
||||
//if (isRR() && s_ow < 0 && !force) // should never happen, the only owner-less spawn outside of map start is for the Holoduke, which is Duke only
|
||||
//return 0;
|
||||
|
||||
int const i = insertsprite(whatsect, s_ss);
|
||||
|
||||
|
|
Loading…
Reference in a new issue