mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- spawn.cpp part 2.
(Beware of the crane! That one's hacky!)
This commit is contained in:
parent
edb991e47d
commit
e2e24fc508
5 changed files with 50 additions and 49 deletions
|
@ -778,7 +778,6 @@ void movecrane(DDukeActor *actor, int crane)
|
|||
if (spri->xvel < 192)
|
||||
spri->xvel += 8;
|
||||
spri->ang = getangle(msx[t[4]] - spri->x, msy[t[4]] - spri->y);
|
||||
//IFMOVING; // JBF 20040825: see my rant above about this
|
||||
ssp(actor, CLIPMASK0);
|
||||
if (((spri->x - msx[t[4]]) * (spri->x - msx[t[4]]) + (spri->y - msy[t[4]]) * (spri->y - msy[t[4]])) < (128 * 128))
|
||||
t[0]++;
|
||||
|
@ -787,7 +786,7 @@ void movecrane(DDukeActor *actor, int crane)
|
|||
else if (t[0] == 9)
|
||||
t[0] = 0;
|
||||
|
||||
setsprite(msy[t[4] + 2], spri->x, spri->y, spri->z - (34 << 8));
|
||||
setsprite(ScriptIndexToActor(msy[t[4] + 2]), spri->x, spri->y, spri->z - (34 << 8));
|
||||
|
||||
auto Owner = actor->GetOwner();
|
||||
if (Owner != nullptr)
|
||||
|
|
|
@ -185,15 +185,15 @@ void checkplayerhurt_r(struct player_struct* p, const Collision& coll);
|
|||
|
||||
void addspritetodelete(int spnum=0);
|
||||
void checkavailinven(struct player_struct* p);
|
||||
int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes);
|
||||
int initspriteforspawn(DDukeActor* j, int pn, const std::initializer_list<int> &excludes);
|
||||
void spawninitdefault(DDukeActor* actj, DDukeActor* act);
|
||||
void spawntransporter(DDukeActor* actj, DDukeActor* acti, bool beam);
|
||||
int spawnbloodpoolpart1(DDukeActor* actj, DDukeActor* acti);
|
||||
void initfootprint(DDukeActor* actj, DDukeActor* acti);
|
||||
void initshell(int j, int i, bool isshell);
|
||||
void initcrane(int j, int i, int CRANEPOLE);
|
||||
void initwaterdrip(int j, int i);
|
||||
int initreactor(int j, int i, bool isrecon);
|
||||
void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell);
|
||||
void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE);
|
||||
void initwaterdrip(DDukeActor* actj, DDukeActor* acti);
|
||||
int initreactor(DDukeActor* actj, DDukeActor* acti, bool isrecon);
|
||||
void spawneffector(int i);
|
||||
void gameexitfrommenu();
|
||||
int startrts(int lumpNum, int localPlayer);
|
||||
|
|
|
@ -103,6 +103,10 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch
|
|||
act->floorz = s_ow->floorz;
|
||||
act->ceilingz = s_ow->ceilingz;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
memset(act->temp_data, 0, sizeof(act->temp_data));
|
||||
if (actorinfo[s_pn].scriptaddress)
|
||||
|
@ -135,16 +139,16 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes)
|
||||
int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_list<int> &excludes)
|
||||
{
|
||||
spritetype* sp;
|
||||
int* t;
|
||||
int i;
|
||||
|
||||
if (j >= 0)
|
||||
if (actj)
|
||||
{
|
||||
auto spawned = EGS(sprite[j].sectnum, sprite[j].x, sprite[j].y, sprite[j].z, pn, 0, 0, 0, 0, 0, 0, &hittype[j], 0);
|
||||
spawned->picnum = sprite[j].picnum;
|
||||
auto spawned = EGS(actj->s.sectnum, actj->s.x, actj->s.y, actj->s.z, pn, 0, 0, 0, 0, 0, 0, actj, 0);
|
||||
spawned->picnum = actj->s.picnum;
|
||||
sp = &spawned->s;
|
||||
t = spawned->temp_data;
|
||||
i = spawned->GetIndex();
|
||||
|
@ -429,14 +433,14 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void initshell(int j, int i, bool isshell)
|
||||
void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &acti->s;
|
||||
int sect = sp->sectnum;
|
||||
auto spj = &sprite[j];
|
||||
auto t = hittype[i].temp_data;
|
||||
if (j >= 0)
|
||||
auto t = acti->temp_data;
|
||||
if (actj)
|
||||
{
|
||||
auto spj = &actj->s;
|
||||
short snum, a;
|
||||
|
||||
if (spj->picnum == TILE_APLAYER)
|
||||
|
@ -473,7 +477,7 @@ void initshell(int j, int i, bool isshell)
|
|||
|
||||
sp->xrepeat = sp->yrepeat = isRR() && isshell? 2 : 4;
|
||||
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(acti, STAT_MISC);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -483,11 +487,11 @@ void initshell(int j, int i, bool isshell)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void initcrane(int j, int i, int CRANEPOLE)
|
||||
void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &acti->s;
|
||||
int sect = sp->sectnum;
|
||||
auto t = hittype[i].temp_data;
|
||||
auto t = acti->temp_data;
|
||||
sp->cstat |= 64 | 257;
|
||||
|
||||
sp->picnum += 2;
|
||||
|
@ -498,14 +502,13 @@ void initcrane(int j, int i, int CRANEPOLE)
|
|||
msy[tempwallptr] = sp->y;
|
||||
msx[tempwallptr + 2] = sp->z;
|
||||
|
||||
int s;
|
||||
StatIterator it(STAT_DEFAULT);
|
||||
while ((s = it.NextIndex()) >= 0)
|
||||
DukeStatIterator it(STAT_DEFAULT);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
auto ss = &sprite[s];
|
||||
auto ss = &act->s;
|
||||
if (ss->picnum == CRANEPOLE && sp->hitag == (ss->hitag))
|
||||
{
|
||||
msy[tempwallptr + 2] = s;
|
||||
msy[tempwallptr + 2] = ActorToScriptIndex(act);
|
||||
|
||||
t[1] = ss->sectnum;
|
||||
|
||||
|
@ -520,7 +523,7 @@ void initcrane(int j, int i, int CRANEPOLE)
|
|||
ss->z = sp->z;
|
||||
ss->shade = sp->shade;
|
||||
|
||||
setsprite(s, ss->x, ss->y, ss->z);
|
||||
setsprite(act, ss->pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -528,7 +531,7 @@ void initcrane(int j, int i, int CRANEPOLE)
|
|||
tempwallptr += 3;
|
||||
sp->owner = -1;
|
||||
sp->extra = 8;
|
||||
changespritestat(i, 6);
|
||||
changespritestat(acti, STAT_STANDABLE);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -537,15 +540,15 @@ void initcrane(int j, int i, int CRANEPOLE)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void initwaterdrip(int j, int i)
|
||||
void initwaterdrip(DDukeActor* actj, DDukeActor* actor)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
int sect = sp->sectnum;
|
||||
auto t = hittype[i].temp_data;
|
||||
if (j >= 0 && (sprite[j].statnum == 10 || sprite[j].statnum == 1))
|
||||
auto t = actor->temp_data;
|
||||
if (actj && (actj->s.statnum == 10 || actj->s.statnum == 1))
|
||||
{
|
||||
sp->shade = 32;
|
||||
if (sprite[j].pal != 1)
|
||||
if (actj->s.pal != 1)
|
||||
{
|
||||
sp->pal = 2;
|
||||
sp->z -= (18 << 8);
|
||||
|
@ -553,9 +556,9 @@ void initwaterdrip(int j, int i)
|
|||
else sp->z -= (13 << 8);
|
||||
sp->ang = getangle(ps[connecthead].posx - sp->x, ps[connecthead].posy - sp->y);
|
||||
sp->xvel = 48 - (krand() & 31);
|
||||
ssp(i, CLIPMASK0);
|
||||
ssp(actor, CLIPMASK0);
|
||||
}
|
||||
else if (j == -1)
|
||||
else if (!actj)
|
||||
{
|
||||
sp->z += (4 << 8);
|
||||
t[0] = sp->z;
|
||||
|
@ -563,7 +566,7 @@ void initwaterdrip(int j, int i)
|
|||
}
|
||||
sp->xrepeat = 24;
|
||||
sp->yrepeat = 24;
|
||||
changespritestat(i, 6);
|
||||
changespritestat(actor, STAT_STANDABLE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -573,9 +576,8 @@ void initwaterdrip(int j, int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int initreactor(int j, int i_, bool isrecon)
|
||||
int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon)
|
||||
{
|
||||
auto actor = &hittype[i_];
|
||||
auto sp = &actor->s;
|
||||
int sect = sp->sectnum;
|
||||
auto t = actor->temp_data;
|
||||
|
|
|
@ -45,12 +45,12 @@ int spawn_d(int j, int pn)
|
|||
{
|
||||
int x;
|
||||
|
||||
int i = initspriteforspawn(j, pn, { CRACK1, CRACK2, CRACK3, CRACK4, SPEAKER, LETTER, DUCK, TARGET, TRIPBOMB, VIEWSCREEN, VIEWSCREEN2 });
|
||||
auto actj = j < 0 ? nullptr : &hittype[j];
|
||||
int i = initspriteforspawn(actj, pn, { CRACK1, CRACK2, CRACK3, CRACK4, SPEAKER, LETTER, DUCK, TARGET, TRIPBOMB, VIEWSCREEN, VIEWSCREEN2 });
|
||||
if (!(i & 0x1000000)) return i;
|
||||
i &= 0xffffff;
|
||||
auto act = &hittype[i];
|
||||
auto sp = &act->s;
|
||||
auto actj = j < 0 ? nullptr : &hittype[j];
|
||||
auto spj = j < 0 ? nullptr : &actj->s;
|
||||
auto t = act->temp_data;
|
||||
int sect = sp->sectnum;
|
||||
|
@ -569,7 +569,7 @@ int spawn_d(int j, int pn)
|
|||
|
||||
case SHELL: //From the player
|
||||
case SHOTGUNSHELL:
|
||||
initshell(j, i, sp->picnum == SHELL);
|
||||
initshell(actj, act, sp->picnum == SHELL);
|
||||
break;
|
||||
|
||||
case RESPAWN:
|
||||
|
@ -685,11 +685,11 @@ int spawn_d(int j, int pn)
|
|||
break;
|
||||
|
||||
case CRANE:
|
||||
initcrane(j, i, CRANEPOLE);
|
||||
initcrane(actj, act, CRANEPOLE);
|
||||
break;
|
||||
|
||||
case WATERDRIP:
|
||||
initwaterdrip(j, i);
|
||||
initwaterdrip(actj, act);
|
||||
break;
|
||||
case TRASH:
|
||||
|
||||
|
@ -943,7 +943,7 @@ int spawn_d(int j, int pn)
|
|||
case REACTOR2:
|
||||
case REACTOR:
|
||||
case RECON:
|
||||
if (initreactor(j, i, sp->picnum == RECON)) return i;
|
||||
if (initreactor(actj, act, sp->picnum == RECON)) return i;
|
||||
break;
|
||||
|
||||
case FLAMETHROWERSPRITE:
|
||||
|
|
|
@ -40,12 +40,12 @@ int spawn_r(int j, int pn)
|
|||
{
|
||||
int x;
|
||||
|
||||
int i = initspriteforspawn(j, pn, { CRACK1, CRACK2, CRACK3, CRACK4 });
|
||||
auto actj = j < 0 ? nullptr : &hittype[j];
|
||||
int i = initspriteforspawn(actj, pn, { CRACK1, CRACK2, CRACK3, CRACK4 });
|
||||
if (!(i & 0x1000000)) return i;
|
||||
i &= 0xffffff;
|
||||
auto act = &hittype[i];
|
||||
auto sp = &act->s;
|
||||
auto actj = j <0? nullptr : &hittype[j];
|
||||
auto spj = j < 0? nullptr : &actj->s;
|
||||
auto t = act->temp_data;
|
||||
int sect = sp->sectnum;
|
||||
|
@ -592,7 +592,7 @@ int spawn_r(int j, int pn)
|
|||
|
||||
case SHELL: //From the player
|
||||
case SHOTGUNSHELL:
|
||||
initshell(j, i, sp->picnum == SHELL);
|
||||
initshell(actj, act, sp->picnum == SHELL);
|
||||
break;
|
||||
case RESPAWN:
|
||||
sp->extra = 66-13;
|
||||
|
@ -699,10 +699,10 @@ int spawn_r(int j, int pn)
|
|||
changespritestat(i, STAT_MISC);
|
||||
break;
|
||||
case CRANE:
|
||||
initcrane(j, i, CRANEPOLE);
|
||||
initcrane(actj, act, CRANEPOLE);
|
||||
break;
|
||||
case WATERDRIP:
|
||||
initwaterdrip(j, i);
|
||||
initwaterdrip(actj, act);
|
||||
break;
|
||||
case TRASH:
|
||||
|
||||
|
@ -1106,7 +1106,7 @@ int spawn_r(int j, int pn)
|
|||
case REACTOR2:
|
||||
case REACTOR:
|
||||
case RECON:
|
||||
if (initreactor(j, i, sp->picnum == RECON)) return i;
|
||||
if (initreactor(actj, act, sp->picnum == RECON)) return i;
|
||||
break;
|
||||
|
||||
case RPG2SPRITE:
|
||||
|
|
Loading…
Reference in a new issue