mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-31 13:10:39 +00:00
- scriptified activators and locators.
This commit is contained in:
parent
9fa2fb75cf
commit
cb005062cd
16 changed files with 148 additions and 56 deletions
|
@ -16,3 +16,6 @@ xx(DukeMasterSwitch)
|
||||||
xx(DukeTouchplate)
|
xx(DukeTouchplate)
|
||||||
xx(DukeSoundController)
|
xx(DukeSoundController)
|
||||||
xx(DukeRespawnController)
|
xx(DukeRespawnController)
|
||||||
|
xx(DukeActivator)
|
||||||
|
xx(DukeActivatorLocked)
|
||||||
|
xx(DukeLocator)
|
||||||
|
|
|
@ -2123,7 +2123,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
||||||
{
|
{
|
||||||
if (a2->spr.statnum != STAT_PLAYER && a2->sector()->lotag != 2 &&
|
if (a2->spr.statnum != STAT_PLAYER && a2->sector()->lotag != 2 &&
|
||||||
(a2->spr.picnum != SECTOREFFECTOR || a2->spr.lotag == SE_49_POINT_LIGHT || a2->spr.lotag == SE_50_SPOT_LIGHT) &&
|
(a2->spr.picnum != SECTOREFFECTOR || a2->spr.lotag == SE_49_POINT_LIGHT || a2->spr.lotag == SE_50_SPOT_LIGHT) &&
|
||||||
a2->spr.picnum != LOCATORS)
|
!islocator(a2))
|
||||||
{
|
{
|
||||||
a2->spr.pos.XY() = rotatepoint(actor->spr.pos.XY(), a2->spr.pos.XY(), diffangle) + vec;
|
a2->spr.pos.XY() = rotatepoint(actor->spr.pos.XY(), a2->spr.pos.XY(), diffangle) + vec;
|
||||||
a2->spr.angle += diffangle;
|
a2->spr.angle += diffangle;
|
||||||
|
@ -2166,7 +2166,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
||||||
DukeSectIterator itr(actOwner->sector());
|
DukeSectIterator itr(actOwner->sector());
|
||||||
while (auto a2 = itr.Next())
|
while (auto a2 = itr.Next())
|
||||||
{
|
{
|
||||||
if (a2->spr.statnum == 1 && badguy(a2) && a2->spr.picnum != SECTOREFFECTOR && a2->spr.picnum != LOCATORS)
|
if (a2->spr.statnum == 1 && badguy(a2) && a2->spr.picnum != SECTOREFFECTOR && !islocator(a2))
|
||||||
{
|
{
|
||||||
auto k = a2->sector();
|
auto k = a2->sector();
|
||||||
updatesector(a2->spr.pos, &k);
|
updatesector(a2->spr.pos, &k);
|
||||||
|
@ -2285,7 +2285,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
|
||||||
DukeSectIterator its(actor->sector());
|
DukeSectIterator its(actor->sector());
|
||||||
while (auto a2 = its.Next())
|
while (auto a2 = its.Next())
|
||||||
{
|
{
|
||||||
if (a2->spr.picnum != SECTOREFFECTOR && a2->spr.picnum != LOCATORS)
|
if (a2->spr.picnum != SECTOREFFECTOR && !islocator(a2))
|
||||||
{
|
{
|
||||||
a2->spr.pos += vect;
|
a2->spr.pos += vect;
|
||||||
|
|
||||||
|
@ -2324,7 +2324,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
|
||||||
DukeSectIterator it(Owner->sector());
|
DukeSectIterator it(Owner->sector());
|
||||||
while (auto a2 = it.Next())
|
while (auto a2 = it.Next())
|
||||||
{
|
{
|
||||||
if (a2->spr.statnum == STAT_ACTOR && badguy(a2) && a2->spr.picnum != SECTOREFFECTOR && a2->spr.picnum != LOCATORS)
|
if (a2->spr.statnum == STAT_ACTOR && badguy(a2) && a2->spr.picnum != SECTOREFFECTOR && !islocator(a2))
|
||||||
{
|
{
|
||||||
// if(a2->spr.sector != actor->spr.sector)
|
// if(a2->spr.sector != actor->spr.sector)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2498,7 +2498,7 @@ int ParseState::parse(void)
|
||||||
DDukeActor* a2;
|
DDukeActor* a2;
|
||||||
while ((a2 = it.Next()))
|
while ((a2 = it.Next()))
|
||||||
{
|
{
|
||||||
if (a2->spr.picnum == ACTIVATOR)
|
if (isactivator(a2))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (a2 == nullptr)
|
if (a2 == nullptr)
|
||||||
|
|
|
@ -29,6 +29,21 @@ inline int isrespawncontroller(DDukeActor* actor)
|
||||||
return actor->GetClass()->TypeName == NAME_DukeRespawnController;
|
return actor->GetClass()->TypeName == NAME_DukeRespawnController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int isactivator(DDukeActor* actor)
|
||||||
|
{
|
||||||
|
return actor->GetClass()->TypeName == NAME_DukeActivator;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int islockedactivator(DDukeActor* actor)
|
||||||
|
{
|
||||||
|
return actor->GetClass()->TypeName == NAME_DukeActivatorLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int islocator(DDukeActor* actor)
|
||||||
|
{
|
||||||
|
return actor->GetClass()->TypeName == NAME_DukeLocator;
|
||||||
|
}
|
||||||
|
|
||||||
inline int badguypic(int const tileNum)
|
inline int badguypic(int const tileNum)
|
||||||
{
|
{
|
||||||
return ((gs.actorinfo[tileNum].flags & (SFLAG_INTERNAL_BADGUY | SFLAG_BADGUY)) != 0);
|
return ((gs.actorinfo[tileNum].flags & (SFLAG_INTERNAL_BADGUY | SFLAG_BADGUY)) != 0);
|
||||||
|
|
|
@ -2446,7 +2446,7 @@ void onMotorcycleHit(int snum, DDukeActor* victim)
|
||||||
p->TurbCount = 6;
|
p->TurbCount = 6;
|
||||||
}
|
}
|
||||||
else if ((victim->spr.picnum == RRTILE2431 || victim->spr.picnum == RRTILE2443 || victim->spr.picnum == RRTILE2451 || victim->spr.picnum == RRTILE2455)
|
else if ((victim->spr.picnum == RRTILE2431 || victim->spr.picnum == RRTILE2443 || victim->spr.picnum == RRTILE2451 || victim->spr.picnum == RRTILE2455)
|
||||||
&& victim->spr.picnum != ACTIVATORLOCKED && p->MotoSpeed > 45)
|
&& !islockedactivator(victim) && p->MotoSpeed > 45)
|
||||||
{
|
{
|
||||||
S_PlayActorSound(SQUISHED, victim);
|
S_PlayActorSound(SQUISHED, victim);
|
||||||
if (victim->spr.picnum == RRTILE2431 || victim->spr.picnum == RRTILE2451)
|
if (victim->spr.picnum == RRTILE2431 || victim->spr.picnum == RRTILE2451)
|
||||||
|
|
|
@ -47,10 +47,6 @@ void premapcontroller(DDukeActor* ac)
|
||||||
{
|
{
|
||||||
switch (ac->spr.picnum)
|
switch (ac->spr.picnum)
|
||||||
{
|
{
|
||||||
case ACTIVATOR:
|
|
||||||
case ACTIVATORLOCKED:
|
|
||||||
case LOCATORS:
|
|
||||||
case MUSICANDSFX:
|
|
||||||
case SECTOREFFECTOR:
|
case SECTOREFFECTOR:
|
||||||
ac->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN | CSTAT_SPRITE_ALIGNMENT_MASK);
|
ac->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN | CSTAT_SPRITE_ALIGNMENT_MASK);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1128,7 +1128,7 @@ void operateactivators(int low, player_struct* plr)
|
||||||
{
|
{
|
||||||
if (act->spr.lotag == low)
|
if (act->spr.lotag == low)
|
||||||
{
|
{
|
||||||
if (act->spr.picnum == ACTIVATORLOCKED)
|
if (islockedactivator(act))
|
||||||
{
|
{
|
||||||
act->sector()->lotag ^= 16384;
|
act->sector()->lotag ^= 16384;
|
||||||
|
|
||||||
|
|
|
@ -592,7 +592,7 @@ void activatebysector_d(sectortype* sect, DDukeActor* activator)
|
||||||
DukeSectIterator it(sect);
|
DukeSectIterator it(sect);
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
{
|
{
|
||||||
if (act->spr.picnum == ACTIVATOR)
|
if (isactivator(act))
|
||||||
{
|
{
|
||||||
operateactivators(act->spr.lotag, nullptr);
|
operateactivators(act->spr.lotag, nullptr);
|
||||||
didit = 1;
|
didit = 1;
|
||||||
|
@ -1669,7 +1669,7 @@ void checksectors_d(int snum)
|
||||||
DukeSectIterator it(near.hitSector);
|
DukeSectIterator it(near.hitSector);
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
{
|
{
|
||||||
if (act->spr.picnum == ACTIVATOR || ismasterswitch(act))
|
if (isactivator(act) || ismasterswitch(act))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
operatesectors(near.hitSector, p->GetActor());
|
operatesectors(near.hitSector, p->GetActor());
|
||||||
|
@ -1681,7 +1681,7 @@ void checksectors_d(int snum)
|
||||||
DukeSectIterator it(p->GetActor()->sector());
|
DukeSectIterator it(p->GetActor()->sector());
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
{
|
{
|
||||||
if (act->spr.picnum == ACTIVATOR || ismasterswitch(act)) return;
|
if (isactivator(act) || ismasterswitch(act)) return;
|
||||||
}
|
}
|
||||||
operatesectors(p->GetActor()->sector(), p->GetActor());
|
operatesectors(p->GetActor()->sector(), p->GetActor());
|
||||||
}
|
}
|
||||||
|
|
|
@ -875,7 +875,7 @@ void activatebysector_r(sectortype* sect, DDukeActor* activator)
|
||||||
DukeSectIterator it(sect);
|
DukeSectIterator it(sect);
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
{
|
{
|
||||||
if (act->spr.picnum == ACTIVATOR)
|
if (isactivator(act))
|
||||||
{
|
{
|
||||||
operateactivators(act->spr.lotag, nullptr);
|
operateactivators(act->spr.lotag, nullptr);
|
||||||
// return;
|
// return;
|
||||||
|
@ -2637,7 +2637,7 @@ void checksectors_r(int snum)
|
||||||
DukeSectIterator it(near.hitSector);
|
DukeSectIterator it(near.hitSector);
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
{
|
{
|
||||||
if (act->spr.picnum == ACTIVATOR || ismasterswitch(act))
|
if (isactivator(act) || ismasterswitch(act))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (haskey(near.hitSector, snum))
|
if (haskey(near.hitSector, snum))
|
||||||
|
@ -2658,7 +2658,7 @@ void checksectors_r(int snum)
|
||||||
DukeSectIterator it(p->GetActor()->sector());
|
DukeSectIterator it(p->GetActor()->sector());
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
{
|
{
|
||||||
if (act->spr.picnum == ACTIVATOR || ismasterswitch(act))
|
if (isactivator(act) || ismasterswitch(act))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (haskey(near.hitSector, snum))
|
if (haskey(near.hitSector, snum))
|
||||||
|
|
|
@ -297,7 +297,7 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act)
|
||||||
act->clipdist = 20;
|
act->clipdist = 20;
|
||||||
if (actj)
|
if (actj)
|
||||||
{
|
{
|
||||||
if (actj->spr.picnum == RESPAWN)
|
if (isrespawncontroller(actj))
|
||||||
act->tempval = act->spr.pal = actj->spr.pal;
|
act->tempval = act->spr.pal = actj->spr.pal;
|
||||||
ChangeActorStat(act, STAT_ACTOR);
|
ChangeActorStat(act, STAT_ACTOR);
|
||||||
}
|
}
|
||||||
|
@ -917,7 +917,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
|
||||||
DukeSectIterator it(actor->sector());
|
DukeSectIterator it(actor->sector());
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
if (itActor->spr.picnum == ACTIVATOR || itActor->spr.picnum == ACTIVATORLOCKED)
|
if (isactivator(itActor) || islockedactivator(itActor))
|
||||||
actor->flags2 |= SFLAG2_USEACTIVATOR;
|
actor->flags2 |= SFLAG2_USEACTIVATOR;
|
||||||
}
|
}
|
||||||
ChangeActorStat(actor, STAT_LIGHT);
|
ChangeActorStat(actor, STAT_LIGHT);
|
||||||
|
|
|
@ -520,18 +520,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
||||||
initshell(actj, act, act->spr.picnum == SHELL);
|
initshell(actj, act, act->spr.picnum == SHELL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESPAWN:
|
|
||||||
act->spr.extra = 66 - 13;
|
|
||||||
if (ud.multimode < 2 && act->spr.pal == 1)
|
|
||||||
{
|
|
||||||
act->spr.scale = DVector2(0, 0);
|
|
||||||
ChangeActorStat(act, STAT_MISC);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
act->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
|
||||||
ChangeActorStat(act, STAT_FX);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ONFIRE:
|
case ONFIRE:
|
||||||
// Twentieth Anniversary World Tour
|
// Twentieth Anniversary World Tour
|
||||||
if (!isWorldTour())
|
if (!isWorldTour())
|
||||||
|
@ -779,19 +767,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOCATORS:
|
|
||||||
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
|
||||||
ChangeActorStat(act, STAT_LOCATOR);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ACTIVATORLOCKED:
|
|
||||||
case ACTIVATOR:
|
|
||||||
act->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
|
||||||
if (act->spr.picnum == ACTIVATORLOCKED)
|
|
||||||
act->sector()->lotag |= 16384;
|
|
||||||
ChangeActorStat(act, STAT_ACTIVATOR);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OOZ:
|
case OOZ:
|
||||||
case OOZ2:
|
case OOZ2:
|
||||||
{
|
{
|
||||||
|
|
|
@ -948,18 +948,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case LOCATORS:
|
|
||||||
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
|
||||||
ChangeActorStat(act, STAT_LOCATOR);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ACTIVATORLOCKED:
|
|
||||||
case ACTIVATOR:
|
|
||||||
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
|
||||||
if (act->spr.picnum == ACTIVATORLOCKED)
|
|
||||||
sectp->lotag ^= 16384;
|
|
||||||
ChangeActorStat(act, STAT_ACTIVATOR);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OOZ:
|
case OOZ:
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
spawnclasses
|
spawnclasses
|
||||||
{
|
{
|
||||||
|
2 = DukeActivator
|
||||||
3 = DukeTouchplate
|
3 = DukeTouchplate
|
||||||
|
4 = DukeActivatorLocked
|
||||||
5 = DukeSoundController
|
5 = DukeSoundController
|
||||||
|
6 = DukeLocator
|
||||||
8 = DukeMasterSwitch
|
8 = DukeMasterSwitch
|
||||||
9 = DukeRespawnController
|
9 = DukeRespawnController
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
spawnclasses
|
spawnclasses
|
||||||
{
|
{
|
||||||
|
2 = DukeActivator
|
||||||
3 = DukeTouchplate
|
3 = DukeTouchplate
|
||||||
|
4 = DukeActivatorLocked
|
||||||
5 = DukeSoundController
|
5 = DukeSoundController
|
||||||
|
6 = DukeLocator
|
||||||
8 = DukeMasterSwitch
|
8 = DukeMasterSwitch
|
||||||
9 = DukeRespawnController
|
9 = DukeRespawnController
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ version "4.10"
|
||||||
#include "zscript/games/duke/ui/screens.zs"
|
#include "zscript/games/duke/ui/screens.zs"
|
||||||
#include "zscript/games/duke/ui/cutscenes.zs"
|
#include "zscript/games/duke/ui/cutscenes.zs"
|
||||||
#include "zscript/games/duke/ui/menu.zs"
|
#include "zscript/games/duke/ui/menu.zs"
|
||||||
|
#include "zscript/games/duke/actors/controllers.zs"
|
||||||
#include "zscript/games/duke/actors/masterswitch.zs"
|
#include "zscript/games/duke/actors/masterswitch.zs"
|
||||||
#include "zscript/games/duke/actors/touchplate.zs"
|
#include "zscript/games/duke/actors/touchplate.zs"
|
||||||
#include "zscript/games/duke/actors/soundcontroller.zs"
|
#include "zscript/games/duke/actors/soundcontroller.zs"
|
||||||
|
|
108
wadsrc/static/zscript/games/duke/actors/controllers.zs
Normal file
108
wadsrc/static/zscript/games/duke/actors/controllers.zs
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
|
||||||
|
class DukeActivator : DukeActor
|
||||||
|
{
|
||||||
|
default
|
||||||
|
{
|
||||||
|
statnum STAT_ACTIVATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
override void Initialize()
|
||||||
|
{
|
||||||
|
self.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this first needs work on the sector effectors.
|
||||||
|
override void onActivate(int low, DukePlayer plr)
|
||||||
|
{
|
||||||
|
switch (self.hitag)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (self.sector.floorz != self.sector.ceilingz)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (self.sector.floorz == self.sector.ceilingz)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.sector.lotag < 3)
|
||||||
|
{
|
||||||
|
DukeSectIterator itr;
|
||||||
|
for(let a2 = itr.First(self.sector); a2; a2 = itr.Next())
|
||||||
|
{
|
||||||
|
// todo: move this into the effectors as a virtual override.
|
||||||
|
if (a2.statnum == STAT_EFFECTOR) switch (a2.lotag)
|
||||||
|
{
|
||||||
|
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
|
||||||
|
if (Raze.isRRRA()) break;
|
||||||
|
|
||||||
|
case SE_36_PROJ_SHOOTER:
|
||||||
|
case SE_31_FLOOR_RISE_FALL:
|
||||||
|
case SE_32_CEILING_RISE_FALL:
|
||||||
|
a2.temp_data[0] = 1 - a2.temp_data[0];
|
||||||
|
a2.callsound(self.sector());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k == -1 && (self.sector.lotag & 0xff) == SE_22_TEETH_DOOR)
|
||||||
|
k = act.callsound(self.sector);
|
||||||
|
|
||||||
|
self.operatesectors(self.sector);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
class DukeLocator : DukeActor
|
||||||
|
{
|
||||||
|
default
|
||||||
|
{
|
||||||
|
statnum STAT_LOCATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
override void Initialize()
|
||||||
|
{
|
||||||
|
self.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DukeActivatorLocked : DukeActor
|
||||||
|
{
|
||||||
|
default
|
||||||
|
{
|
||||||
|
statnum STAT_ACTIVATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
override void Initialize()
|
||||||
|
{
|
||||||
|
self.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||||
|
if (!Raze.IsRR()) self.lotag |= 16384;
|
||||||
|
else self.lotag ^= 16384;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* must wait until Activator.onActivate can be done.
|
||||||
|
override void onActivate(int low, DukePlayer plr)
|
||||||
|
{
|
||||||
|
if (self.lotag == low)
|
||||||
|
{
|
||||||
|
self.sector.lotag ^= 16384;
|
||||||
|
|
||||||
|
if (plr)
|
||||||
|
{
|
||||||
|
if (self.sector.lotag & 16384)
|
||||||
|
plr.FTA(QUOTE_LOCKED, true);
|
||||||
|
else plr.FTA(QUOTE_UNLOCKED, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue