Trig_ExecuteAutoexec

This commit is contained in:
krystalgamer 2024-07-17 17:58:37 +02:00
parent 789d4c2aaa
commit 90f79d5218
4 changed files with 42 additions and 5 deletions

View File

@ -10,7 +10,7 @@
CBaddy* ControlBaddyList;
extern i16** gTrigNodes;
extern u16** gTrigNodes;
// @NotOk
// check when pathcheck is done <3
@ -74,7 +74,7 @@ i32 CBaddy::GetNextWaypoint(void)
this->field_1F4 = LinksPointer[1];
i16* v4 = gTrigNodes[this->field_1F4];
u16* v4 = gTrigNodes[this->field_1F4];
this->field_2F0 = 0;
if (*v4 == 1000 || *v4 == 1002)

View File

@ -2,6 +2,8 @@
#include "mess.h"
#include "validate.h"
EXPORT i32 JoelJewCheatCode;
EXPORT int PShell_DrawMenuBox(int, int, int, int, int, int, int, int){
return 69;

View File

@ -5,7 +5,7 @@
#include "spidey.h"
EXPORT void* gTrigFile;
EXPORT i16 **gTrigNodes;
EXPORT u16 **gTrigNodes;
EXPORT i32 NumNodes;
const i32 MAXPENDING = 16;
@ -17,6 +17,9 @@ static int gRestartPoints;
EXPORT i32 Restart;
EXPORT i32 RestartNode;
EXPORT i32 gReStartDeathRelated;
EXPORT i32 EndLevelNode;
extern i32 JoelJewCheatCode;
extern CPlayer* MechList;
@ -26,6 +29,37 @@ void trigLog(const char*, ...)
printf("trigLog!");
}
// @Ok
void Trig_ExecuteAutoexec(void)
{
print_if_false(gTrigFile != 0, "No trigger file");
EndLevelNode = 0xFFFF;
if (JoelJewCheatCode)
{
for (i32 curNode = 0; curNode < NumNodes; curNode++)
{
u16 *v5 = gTrigNodes[curNode];
if (*v5 == 15)
{
trigLog("*** Executing AUTOEXEC2 Node %i ***", curNode);
ExecuteCommandList(v5 + 1, curNode, 1);
return;
}
}
}
for (i32 curNode = 0; curNode < NumNodes; curNode++)
{
u16 *v5 = gTrigNodes[curNode];
if (*v5 == 4)
{
trigLog("*** Executing AUTOEXEC Node %i ***", curNode);
ExecuteCommandList(v5 + 1, curNode, 1);
}
}
}
// @Ok
void Trig_ExecuteRestart(void)
{
@ -253,7 +287,7 @@ void* Trig_GetLinkInfoList(
{
for (i32 i = 0; i<result && i < count; i++, v8++)
{
i16 *v11 = gTrigNodes[*v8];
u16 *v11 = gTrigNodes[*v8];
pLink[i].field_0 = *v8;
pLink[i].field_4 = *v11;
@ -293,7 +327,7 @@ u16* Trig_GetLinksPointer(int node)
{
print_if_false(node >= 0 && node < NumNodes, "Bad node sent to Trig_GetLinksPointer");
i16* trigNodePtr = gTrigNodes[node];
i16* trigNodePtr = reinterpret_cast<i16*>(gTrigNodes[node]);
if (*trigNodePtr <= 0xD)
{

1
trig.h
View File

@ -64,6 +64,7 @@ EXPORT void Trig_DeleteTrigFile(void);
EXPORT char *SkipString(char *);
EXPORT void Trig_SetRestart(char *);
EXPORT void Trig_ExecuteRestart(void);
EXPORT void Trig_ExecuteAutoexec(void);
void validate_SLinkInfo(void);
void validate_SCommandPoint(void);