Port some callfuncs from base SRB2 ACS merge

This could be handy for all sorts of stuff
This commit is contained in:
NepDisk 2024-11-25 11:40:09 -05:00
parent a09bde5364
commit 83fc4e8342
6 changed files with 1517 additions and 7 deletions

File diff suppressed because it is too large Load diff

View file

@ -62,6 +62,10 @@ bool CallFunc_EndPrintBold(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM
bool CallFunc_PlayerTeam(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerRings(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerScore(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerNumber(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_ActivatorTID(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_EndLog(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_strcmp(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
@ -74,7 +78,40 @@ bool CallFunc_CountPushables(ACSVM::Thread *thread, const ACSVM::Word *argV, ACS
bool CallFunc_PlayerSkin(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerBot(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerLosing(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerExiting(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_PlayerExiting(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
;
bool CallFunc_Teleport(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
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_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);
bool CallFunc_GetObjectVelX(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectVelY(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectVelZ(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectAngle(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectRoll(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectPitch(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectFloorZ(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectCeilingZ(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectFloorTexture(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
//bool CallFunc_GetObjectLightLevel(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_CheckObjectState(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_CheckObjectFlag(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectClass(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectPosition(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectVelocity(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectAngle(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectRoll(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectPitch(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectState(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectFlag(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectClass(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectDye(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetObjectSpecial(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetObjectDye(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);
@ -98,6 +135,20 @@ bool CallFunc_MusicPlay(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::W
bool CallFunc_MusicStopAll(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_MusicRemap(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);
bool CallFunc_Arcsin(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Arccos(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Hypot(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Sqrt(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Floor(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Ceil(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_Round(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_InvAngle(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_OppositeColor(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetLineProperty(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_SetLineProperty(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);
bool CallFunc_GetSideProperty(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC);

View file

@ -99,6 +99,7 @@ Environment::Environment()
addCodeDataACS0(122, {"", 0, addCallFunc(CallFunc_PlayerScore)});
// 136 to 137: Implemented by ACSVM
addCodeDataACS0(149, {"", 6, addCallFunc(CallFunc_SpawnObject)});
// 157: Implemented by ACSVM
@ -107,23 +108,56 @@ Environment::Environment()
// 175 to 179: Implemented by ACSVM
// 181 to 189: Implemented by ACSVM
addCodeDataACS0(196, {"", 1, addCallFunc(CallFunc_GetObjectX)});
addCodeDataACS0(197, {"", 1, addCallFunc(CallFunc_GetObjectY)});
addCodeDataACS0(198, {"", 1, addCallFunc(CallFunc_GetObjectZ)});
addFuncDataACS0( 200, addCallFunc(CallFunc_GetObjectVelX));
addFuncDataACS0( 201, addCallFunc(CallFunc_GetObjectVelY));
addFuncDataACS0( 202, addCallFunc(CallFunc_GetObjectVelZ));
addFuncDataACS0( 203, addCallFunc(CallFunc_GetObjectRoll));
addFuncDataACS0( 204, addCallFunc(CallFunc_GetObjectFloorTexture));
addFuncDataACS0( 205, addCallFunc(CallFunc_CheckObjectState));
addFuncDataACS0( 206, addCallFunc(CallFunc_CheckObjectFlag));
addFuncDataACS0( 207, addCallFunc(CallFunc_GetObjectClass));
addFuncDataACS0( 208, addCallFunc(CallFunc_GetObjectDye));
addFuncDataACS0( 209, addCallFunc(CallFunc_SetObjectVelocity));
addFuncDataACS0( 210, addCallFunc(CallFunc_SetObjectRoll));
addFuncDataACS0( 211, addCallFunc(CallFunc_SetObjectFlag));
addFuncDataACS0( 212, addCallFunc(CallFunc_SetObjectClass));
addFuncDataACS0( 213, addCallFunc(CallFunc_SetObjectDye));
addFuncDataACS0( 214, addCallFunc(CallFunc_SpawnObjectForced));
// 203 to 217: Implemented by ACSVM
addCodeDataACS0(220, {"", 2, addCallFunc(CallFunc_Sin)});
addCodeDataACS0(221, {"", 2, addCallFunc(CallFunc_Cos)});
// 225 to 243: Implemented by ACSVM
addCodeDataACS0(247, {"", 0, addCallFunc(CallFunc_PlayerNumber)});
addCodeDataACS0(248, {"", 0, addCallFunc(CallFunc_ActivatorTID)});
// 253: Implemented by ACSVM
// 256 to 257: Implemented by ACSVM
addCodeDataACS0(259, {"", 1, addCallFunc(CallFunc_GetObjectFloorZ)});
// 263: Implemented by ACSVM
addCodeDataACS0(260, {"", 1, addCallFunc(CallFunc_GetObjectAngle)});
addCodeDataACS0(270, {"", 0, addCallFunc(CallFunc_EndLog)});
// 273 to 275: Implemented by ACSVM
addCodeDataACS0(276, {"", 2, addCallFunc(CallFunc_SetObjectAngle)});
addCodeDataACS0(282, {"", 1, addCallFunc(CallFunc_GetObjectCeilingZ)});
// 291 to 325: Implemented by ACSVM
// 330: Implemented by ACSVM
addCodeDataACS0(331, {"", 1, addCallFunc(CallFunc_GetObjectPitch)});
addCodeDataACS0(332, {"", 1, addCallFunc(CallFunc_SetObjectPitch)});
addCodeDataACS0(334, {"", 1, addCallFunc(CallFunc_SetObjectState)});
//addCodeDataACS0(340, {"", 1, addCallFunc(CallFunc_GetObjectLightLevel)});
// 349 to 361: Implemented by ACSVM
// 363 to 380: Implemented by ACSVM
@ -179,6 +213,9 @@ Environment::Environment()
addFuncDataACS0( 319, addCallFunc(CallFunc_PlayerLosing));
addFuncDataACS0( 320, addCallFunc(CallFunc_PlayerExiting));
addFuncDataACS0( 322, addCallFunc(CallFunc_Teleport));
addFuncDataACS0( 323, addCallFunc(CallFunc_SetViewpoint));
addFuncDataACS0( 500, addCallFunc(CallFunc_CameraWait));
addFuncDataACS0( 501, addCallFunc(CallFunc_PodiumPosition));
@ -200,11 +237,19 @@ Environment::Environment()
addFuncDataACS0( 603, addCallFunc(CallFunc_PlaceHolder));
addFuncDataACS0( 604, addCallFunc(CallFunc_PlaceHolder));
addFuncDataACS0( 605, addCallFunc(CallFunc_PlaceHolder));
*/
addFuncDataACS0( 700, addCallFunc(CallFunc_Tan));
addFuncDataACS0( 701, addCallFunc(CallFunc_Arcsin));
addFuncDataACS0( 702, addCallFunc(CallFunc_Arccos));
addFuncDataACS0( 703, addCallFunc(CallFunc_Hypot));
addFuncDataACS0( 704, addCallFunc(CallFunc_Sqrt));
addFuncDataACS0( 705, addCallFunc(CallFunc_Floor));
addFuncDataACS0( 706, addCallFunc(CallFunc_Ceil));
addFuncDataACS0( 707, addCallFunc(CallFunc_Round));
addFuncDataACS0( 710, addCallFunc(CallFunc_InvAngle));
addFuncDataACS0( 711, addCallFunc(CallFunc_OppositeColor));
addFuncDataACS0( 700, addCallFunc(CallFunc_PlaceHolder));
addFuncDataACS0( 701, addCallFunc(CallFunc_PlaceHolder));
addFuncDataACS0( 702, addCallFunc(CallFunc_PlaceHolder));
addFuncDataACS0( 703, addCallFunc(CallFunc_PlaceHolder));*/
}
ACSVM::Thread *Environment::allocThread()

View file

@ -427,7 +427,7 @@ void A_SetTics();
void A_SetRandomTics();
void A_ChangeColorRelative();
void A_ChangeColorAbsolute();
void A_Dye();
void A_Dye(mobj_t *actor);
void A_MoveRelative();
void A_MoveAbsolute();
void A_Thrust();

View file

@ -328,6 +328,8 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
#define P_CameraGetFOFTopZ(mobj, sector, fof, x, y, line) P_CameraCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false)
#define P_CameraGetFOFBottomZ(mobj, sector, fof, x, y, line) P_CameraFloorZ(mobj, sectors + fof->secnum, sector, x, y, line, true, false)
INT32 P_FloorPicAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover);
boolean P_CheckDeathPitCollide(mobj_t *mo);
boolean P_CheckSolidLava(ffloor_t *rover);

View file

@ -1041,6 +1041,42 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
} else // Well, that makes it easy. Just get the ceiling height
return sector->ceilingheight;
}
INT32 P_FloorPicAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
{
sector_t *sector = R_PointInSubsector(x, y)->sector;
INT32 floorpic = sector->floorpic;
if (sector->ffloors)
{
ffloor_t *best = NULL;
fixed_t thingtop = z + height;
for (ffloor_t *rover = sector->ffloors; rover; rover = rover->next)
{
if (!(rover->fofflags & FOF_EXISTS))
continue;
fixed_t topheight = P_GetFFloorTopZAt(rover, x, y);
fixed_t bottomheight = P_GetFFloorBottomZAt(rover, x, y);
fixed_t delta1 = z - (bottomheight + ((topheight - bottomheight)/2));
fixed_t delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2));
if (topheight > P_GetFFloorTopZAt(best, x, y) && abs(delta1) < abs(delta2))
{
best = rover;
}
}
if (best)
floorpic = *best->toppic;
}
return floorpic;
}
static void P_PlayerFlip(mobj_t *mo)
{
if (!mo->player)