Add Check2DMode and Set2DMode

Remove Switch2DMode
This commit is contained in:
Lactozilla 2024-04-30 00:48:44 -03:00
parent 263e0577ad
commit a12db200e8
4 changed files with 112 additions and 58 deletions

View file

@ -65,6 +65,9 @@ special
-342:PlayerHoldingFlag(2),
-343:PlayerIsIt(1),
-344:PlayerFinished(1),
-345:Check2DMode(0),
-346:Set2DMode(1),
-500:CameraWait(1),
-503:SetLineRenderStyle(3),
-504:MapWarp(2),
@ -107,7 +110,6 @@ special
424:Weather_Change(1,2),
428:Plat_StartMovement(1,2),
429:Sector_Crush(1,2),
432:Switch2DMode(0,1),
433:GravityFlip(0,2),
435:Plane_ChangeScrollerDirection(2),
436:FOF_Shatter(2),

View file

@ -1938,6 +1938,58 @@ bool CallFunc_SpawnObjectForced(ACSVM::Thread *thread, const ACSVM::Word *argV,
return false;
}
/*--------------------------------------------------
bool CallFunc_SpawnProjectile(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Spawns a projectile.
--------------------------------------------------*/
bool CallFunc_SpawnProjectile(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
(void)argC;
auto info = &static_cast<Thread *>(thread)->info;
mobj_t *mobj = P_FindMobjFromTID(argV[0], NULL, info->mo);
if (mobj != NULL && P_MobjWasRemoved(mobj) == false)
{
ACSVM::String *str = thread->scopeMap->getString( argV[1] );
if (!str->str || str->len == 0)
{
CONS_Alert(CONS_WARNING, "SpawnProjectile projectile class was not provided.\n");
NO_RETURN(thread);
return false;
}
const char *className = str->str;
mobjtype_t mobjType = MT_NULL;
if (ACS_GetMobjTypeFromString(className, &mobjType) == false)
{
CONS_Alert(CONS_WARNING,
"Couldn't find actor class \"%s\" for SpawnProjectile.\n",
className
);
NO_RETURN(thread);
return false;
}
mobj_t *missile = P_SpawnMissileAtSpeeds(mobj, mobjType, ACS_FixedToAngle(argV[2]), argV[3], argV[4], argV[5] != 0);
if (missile && argV[6] != 0)
{
P_SetThingTID(mobj, argV[6]);
}
}
NO_RETURN(thread);
return false;
}
/*--------------------------------------------------
bool CallFunc_TrackObjectAngle(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
@ -1989,6 +2041,57 @@ bool CallFunc_StopTrackingObjectAngle(ACSVM::Thread *thread, const ACSVM::Word *
return false;
}
/*--------------------------------------------------
bool CallFunc_Check2DMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Checks if the activator is in 2D mode.
--------------------------------------------------*/
bool CallFunc_Check2DMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
(void)argV;
(void)argC;
auto info = &static_cast<Thread *>(thread)->info;
bool in2DMode = false;
if ((info != NULL)
&& (info->mo != NULL && P_MobjWasRemoved(info->mo) == false))
{
if (info->mo->flags2 & MF2_TWOD)
in2DMode = true;
}
thread->dataStk.push(in2DMode);
return false;
}
/*--------------------------------------------------
bool CallFunc_Set2DMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Implementation of linedef type 432.
--------------------------------------------------*/
bool CallFunc_Set2DMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
(void)argC;
auto info = &static_cast<Thread *>(thread)->info;
if ((info != NULL)
&& (info->mo != NULL && P_MobjWasRemoved(info->mo) == false))
{
if (argV[0] != 0)
info->mo->flags2 |= MF2_TWOD;
else
info->mo->flags2 &= ~MF2_TWOD;
}
NO_RETURN(thread);
return false;
}
/*--------------------------------------------------
bool CallFunc_PlayerEmeralds(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
@ -5288,58 +5391,6 @@ bool CallFunc_PlayerFinished(ACSVM::Thread *thread, const ACSVM::Word *argV, ACS
return false;
}
/*--------------------------------------------------
bool CallFunc_SpawnProjectile(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
Spawns a projectile.
--------------------------------------------------*/
bool CallFunc_SpawnProjectile(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
(void)argC;
auto info = &static_cast<Thread *>(thread)->info;
mobj_t *mobj = P_FindMobjFromTID(argV[0], NULL, info->mo);
if (mobj != NULL && P_MobjWasRemoved(mobj) == false)
{
ACSVM::String *str = thread->scopeMap->getString( argV[1] );
if (!str->str || str->len == 0)
{
CONS_Alert(CONS_WARNING, "SpawnProjectile projectile class was not provided.\n");
NO_RETURN(thread);
return false;
}
const char *className = str->str;
mobjtype_t mobjType = MT_NULL;
if (ACS_GetMobjTypeFromString(className, &mobjType) == false)
{
CONS_Alert(CONS_WARNING,
"Couldn't find actor class \"%s\" for SpawnProjectile.\n",
className
);
NO_RETURN(thread);
return false;
}
mobj_t *missile = P_SpawnMissileAtSpeeds(mobj, mobjType, ACS_FixedToAngle(argV[2]), argV[3], argV[4], argV[5] != 0);
if (missile && argV[6] != 0)
{
P_SetThingTID(mobj, argV[6]);
}
}
NO_RETURN(thread);
return false;
}
/*--------------------------------------------------
bool CallFunc_Sin(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)

View file

@ -57,6 +57,7 @@ bool CallFunc_SectorSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM:
bool CallFunc_AmbientSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetLineTexture(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetLineSpecial(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetLineRenderStyle(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_ChangeSky(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_ThingSound(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_EndPrintBold(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
@ -82,8 +83,11 @@ bool CallFunc_Teleport(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Wo
bool CallFunc_SetViewpoint(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SpawnObject(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SpawnObjectForced(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SpawnProjectile(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_TrackObjectAngle(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_StopTrackingObjectAngle(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Check2DMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Set2DMode(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerEmeralds(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerLap(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_LowestLap(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
@ -94,9 +98,6 @@ bool CallFunc_ModeAttacking(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSV
bool CallFunc_RecordAttack(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_NiGHTSAttack(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetLineRenderStyle(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
// Some useful actor functions.
bool CallFunc_GetObjectX(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectY(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectZ(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
@ -166,8 +167,6 @@ bool CallFunc_PlayerHoldingFlag(ACSVM::Thread *thread, const ACSVM::Word *argV,
bool CallFunc_PlayerIsIt(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerFinished(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SpawnProjectile(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Sin(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Cos(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Tan(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);

View file

@ -233,6 +233,8 @@ Environment::Environment()
addFuncDataACS0( 342, addCallFunc(CallFunc_PlayerHoldingFlag));
addFuncDataACS0( 343, addCallFunc(CallFunc_PlayerIsIt));
addFuncDataACS0( 344, addCallFunc(CallFunc_PlayerFinished));
addFuncDataACS0( 345, addCallFunc(CallFunc_Check2DMode));
addFuncDataACS0( 346, addCallFunc(CallFunc_Set2DMode));
addFuncDataACS0( 500, addCallFunc(CallFunc_CameraWait));
addFuncDataACS0( 503, addCallFunc(CallFunc_SetLineRenderStyle));