mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 04:24:39 +00:00
- migrate all script related info to the data stored in the actor classes.
This also needs cactor to really change the class descriptor now so that the correct script code is found.
This commit is contained in:
parent
c418356420
commit
8bd88b8678
3 changed files with 28 additions and 20 deletions
|
@ -1949,11 +1949,6 @@ int ParseState::parse(void)
|
|||
g_ac->spr.cstat = ESpriteFlags::FromInt(*insptr);
|
||||
insptr++;
|
||||
break;
|
||||
case concmd_newpic:
|
||||
insptr++;
|
||||
g_ac->spr.picnum = (short)*insptr;
|
||||
insptr++;
|
||||
break;
|
||||
case concmd_ifmove:
|
||||
insptr++;
|
||||
parseifelse((g_ac->curMove - moves.Data()) == *insptr);
|
||||
|
@ -2120,12 +2115,19 @@ int ParseState::parse(void)
|
|||
insptr++;
|
||||
break;
|
||||
|
||||
case concmd_newpic:
|
||||
case concmd_cactor:
|
||||
{
|
||||
insptr++;
|
||||
g_ac->spr.picnum = *insptr;
|
||||
auto info = spawnMap.CheckKey(*insptr);
|
||||
if (info != nullptr)
|
||||
{
|
||||
g_ac->ChangeType(info->cls);
|
||||
g_ac->spr.picnum = *insptr;
|
||||
}
|
||||
insptr++;
|
||||
break;
|
||||
|
||||
}
|
||||
case concmd_ifbulletnear:
|
||||
parseifelse( dodge(g_ac) == 1);
|
||||
break;
|
||||
|
@ -3189,8 +3191,9 @@ void LoadActor(DDukeActor *actor, int p, int x)
|
|||
s.g_x = x; // ??
|
||||
s.g_ac = actor;
|
||||
|
||||
if (actor->spr.picnum < 0 || actor->spr.picnum >= MAXTILES) return;
|
||||
auto addr = gs.actorinfo[actor->spr.picnum].loadeventscriptptr;
|
||||
auto coninf = actor->conInfo();
|
||||
if (coninf == nullptr) return;
|
||||
auto addr = coninf->loadeventscriptptr;
|
||||
if (addr == 0) return;
|
||||
|
||||
s.killit_flag = 0;
|
||||
|
@ -3244,13 +3247,17 @@ void LoadActor(DDukeActor *actor, int p, int x)
|
|||
|
||||
bool execute(DDukeActor *actor,int p,double xx)
|
||||
{
|
||||
if (gs.actorinfo[actor->spr.picnum].scriptaddress == 0) return false;
|
||||
auto coninf = actor->conInfo();
|
||||
if (coninf == nullptr)
|
||||
return false;
|
||||
|
||||
ParseState s;
|
||||
s.g_p = p; // Player ID
|
||||
s.g_x = int(xx / maptoworld); // ??
|
||||
s.g_ac = actor;
|
||||
s.insptr = &ScriptCode[4 + (gs.actorinfo[actor->spr.picnum].scriptaddress)];
|
||||
auto insptr = coninf? &ScriptCode[4 + coninf->scriptaddress] : nullptr;
|
||||
if (insptr != s.insptr) Printf("%s: %p vs. %p\n", insptr, s.insptr);
|
||||
s.killit_flag = 0;
|
||||
|
||||
int done;
|
||||
|
|
|
@ -121,11 +121,11 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor*
|
|||
|
||||
}
|
||||
|
||||
s_pn = act->spr.picnum;
|
||||
memset(act->temp_data, 0, sizeof(act->temp_data));
|
||||
if (gs.actorinfo[s_pn].scriptaddress)
|
||||
auto coninf = act->conInfo();
|
||||
if (coninf)
|
||||
{
|
||||
auto sa = &ScriptCode[gs.actorinfo[s_pn].scriptaddress];
|
||||
auto sa = &ScriptCode[coninf->scriptaddress];
|
||||
act->curAction = &actions[sa[1]];
|
||||
act->curMove = &moves[sa[2]];
|
||||
act->spr.hitag = sa[3];
|
||||
|
@ -226,16 +226,17 @@ bool initspriteforspawn(DDukeActor* act)
|
|||
}
|
||||
}
|
||||
|
||||
int s = act->spr.picnum;
|
||||
|
||||
if (act->spr.cstat & CSTAT_SPRITE_BLOCK) act->spr.cstat |= CSTAT_SPRITE_BLOCK_HITSCAN;
|
||||
|
||||
act->spr.extra = act->IntVar(NAME_strength);
|
||||
if (gs.actorinfo[s].scriptaddress)
|
||||
|
||||
auto coninf = act->conInfo();
|
||||
if (coninf)
|
||||
{
|
||||
act->curAction = &actions[ScriptCode[gs.actorinfo[s].scriptaddress+1]];
|
||||
act->curMove = &moves[ScriptCode[gs.actorinfo[s].scriptaddress+2]];
|
||||
int s3 = ScriptCode[gs.actorinfo[s].scriptaddress+3];
|
||||
auto sa = &ScriptCode[coninf->scriptaddress];
|
||||
act->curAction = &actions[sa[1]];
|
||||
act->curMove = &moves[sa[2]];
|
||||
int s3 = ScriptCode[sa[3]];
|
||||
if (s3 && act->spr.hitag == 0)
|
||||
act->spr.hitag = s3;
|
||||
}
|
||||
|
|
|
@ -575,7 +575,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, badguy, badguy)
|
|||
|
||||
int duke_scripted(DDukeActor* act)
|
||||
{
|
||||
return gs.actorinfo[act->spr.picnum].scriptaddress > 0;
|
||||
return act->conInfo() != nullptr;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, scripted, duke_scripted)
|
||||
|
|
Loading…
Reference in a new issue