mirror of
https://github.com/SeekyCt/spm-decomp.git
synced 2024-12-02 18:36:20 +00:00
evt_halt and evt_if_str_equal
This commit is contained in:
parent
ce050e24a4
commit
bd35573dad
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
.vscode
|
||||
help.txt
|
||||
ldhelp.txt
|
||||
*.s
|
||||
*.s
|
||||
*.o
|
25
evtmgr.c
25
evtmgr.c
@ -7,6 +7,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "evtmgr.h"
|
||||
#include "evtmgr_cmd.h"
|
||||
#include "memory.h"
|
||||
#include "somewhere.h"
|
||||
#include "mariost.h"
|
||||
@ -156,8 +157,7 @@ EvtEntry * evtEntry(int * script, uint8_t priority, uint8_t flags) {
|
||||
entry->unknown_0x160 = 0.0f;
|
||||
entry->unknown_0x164 = -1;
|
||||
entry->unknown_0x168 = 0;
|
||||
entry->unknown_0x4 = 0;
|
||||
entry->unknown_0x0 = 0;
|
||||
entry->lifetime = 0;
|
||||
for (int j = 0; j < 16; j++) {
|
||||
entry->lw[i] = 0;
|
||||
}
|
||||
@ -197,6 +197,7 @@ EvtEntry * evtEntry(int * script, uint8_t priority, uint8_t flags) {
|
||||
// unfinished
|
||||
void evtmgrMain() {
|
||||
EvtWork * wp = evtGetWork();
|
||||
runMainF = 1;
|
||||
int64_t timeDif = gp->time - wp->time;
|
||||
if (timeDif < 0) {
|
||||
timeDif = 0;
|
||||
@ -209,8 +210,26 @@ void evtmgrMain() {
|
||||
wp->time = gp->time;
|
||||
make_pri_table();
|
||||
for (int i = 0; i < priTblNum; i++) {
|
||||
|
||||
EvtEntry * entry = &wp->entries[priTbl[i]];
|
||||
if (entry->flags & 1 && entry->id == priIdTbl[i] && entry->flags & 0x92) {
|
||||
if (entry->flags & 4) {
|
||||
entry->lifetime += ms;
|
||||
}
|
||||
entry->unknown_0x160 += 1.0f;
|
||||
int shouldBreak = 0;
|
||||
while (entry->unknown_0x160 >= 1.0f) {
|
||||
entry->unknown_0x160 -= 1.0f;
|
||||
int ret = evtmgrCmd(entry);
|
||||
if (ret == 1) {
|
||||
shouldBreak = 1;
|
||||
break;
|
||||
}
|
||||
if (ret == -1) break;
|
||||
}
|
||||
if (shouldBreak) break;
|
||||
}
|
||||
}
|
||||
runMainF = 0;
|
||||
}
|
||||
|
||||
void evtDelete(EvtEntry * entry) {
|
||||
|
3
evtmgr.h
3
evtmgr.h
@ -29,7 +29,8 @@ typedef struct _EvtEntry {
|
||||
struct _EvtEntry * childEntry;
|
||||
struct _EvtEntry * brotherEntry;
|
||||
int unknown_0x74;
|
||||
char unknown_0x78[0x94 - 0x78];
|
||||
int64_t unknown_0x78;
|
||||
char unknown_0x80[0x94 - 0x80];
|
||||
user_func * userFunc; // Function set & called by the user_func opcode
|
||||
int lw[16];
|
||||
uint32_t lf[3];
|
||||
|
24
evtmgr_cmd.c
24
evtmgr_cmd.c
@ -1,5 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "evtmgr_cmd.h"
|
||||
#include "evtmgr.h"
|
||||
@ -129,6 +130,29 @@ EVT_CMD_FN(wait_frm) {
|
||||
}
|
||||
}
|
||||
|
||||
// EVT_CMD_FN(wait_msec)
|
||||
|
||||
EVT_CMD_FN(halt) {
|
||||
return evtGetValue(entry, *entry->pCurData) ? 0 : EVT_CONTINUE;
|
||||
}
|
||||
|
||||
EVT_CMD_FN(if_str_equal) {
|
||||
int * p = entry->pCurData;
|
||||
char * s1 = (char *) evtGetValue(entry, p[0]);
|
||||
char * s2 = (char *) evtGetValue(entry, p[1]);
|
||||
if (s1 == NULL) {
|
||||
s1 = "";
|
||||
}
|
||||
if (s2 == NULL) {
|
||||
s2 = "";
|
||||
}
|
||||
if (strcmp(s1, s2)) {
|
||||
entry->pCurInstruction = evtSearchElse(entry);
|
||||
return EVT_CONTINUE;
|
||||
}
|
||||
return EVT_CONTINUE;
|
||||
}
|
||||
|
||||
// a lot
|
||||
|
||||
EVT_CMD_FN(debug_put_msg) {
|
||||
|
13
evtmgr_cmd.h
13
evtmgr_cmd.h
@ -44,9 +44,9 @@ EVT_CMD_FN(while);
|
||||
EVT_CMD_FN(do_break);
|
||||
EVT_CMD_FN(do_continue);
|
||||
EVT_CMD_FN(wait_frm);
|
||||
|
||||
EVT_CMD_FN(wait_msec);
|
||||
EVT_CMD_FN(halt);
|
||||
/*
|
||||
0002f0d4 0000d0 800346b4 4 evt_wait_msec evtmgr_cmd.o
|
||||
UNUSED 00003c ........ evt_halt evtmgr_cmd.o
|
||||
0002efe4 0000f0 800345c4 4 evt_if_str_equal evtmgr_cmd.o
|
||||
0002eef4 0000f0 800344d4 4 evt_if_str_not_equal evtmgr_cmd.o
|
||||
@ -157,10 +157,7 @@ EVT_CMD_FN(debug_name);
|
||||
EVT_CMD_FN(debug_rem);
|
||||
EVT_CMD_FN(debug_bp);
|
||||
|
||||
/*
|
||||
0002af10 0013b0 800304f0 4 evtmgrCmd evtmgr_cmd.o
|
||||
*/
|
||||
|
||||
int evtmgrCmd(EvtEntry * entry);
|
||||
int evtGetValue(EvtEntry * entry, int data);
|
||||
|
||||
/*
|
||||
@ -173,7 +170,9 @@ float evtGetFloat(EvtEntry * entry, int data);
|
||||
/*
|
||||
00029d14 000384 8002f2f4 4 evtSetFloat evtmgr_cmd.o
|
||||
UNUSED 00005c ........ evtSearchLabel evtmgr_cmd.o
|
||||
UNUSED 00006c ........ evtSearchElse evtmgr_cmd.o
|
||||
*/
|
||||
int * evtSearchElse(EvtEntry * entry);
|
||||
/*
|
||||
UNUSED 000064 ........ evtSearchEndIf evtmgr_cmd.o
|
||||
UNUSED 00005c ........ evtSearchEndSwitch evtmgr_cmd.o
|
||||
UNUSED 000080 ........ evtSearchCase evtmgr_cmd.o
|
||||
|
@ -30,7 +30,7 @@ for line1 in f1.readlines():
|
||||
line2 = noComment(noAddress(noNewline(f2.readline())))
|
||||
if line1 != line2:
|
||||
print(Fore.CYAN + f"[{n:04}]: {line1}")
|
||||
print(Fore.YELLOW + f"[{n:04}]: {line2}")
|
||||
print(Fore.YELLOW + f"{{{n:04}}}: {line2}")
|
||||
n += 1
|
||||
f1.close()
|
||||
f2.close()
|
Loading…
Reference in New Issue
Block a user