Crusader_Decomp/USECODE/EUSECODE_extracted/pseudocode/EVENT/slot_0A_equip.txt

623 lines
17 KiB
Text

function event_equip() /* entry=190 class_id=0x0361 slot=0x0A */
{
var
referent, /* [BP+00h] type=0x69 */
event, /* [BP+0Ah] type=0x69 */
item, /* [BP-02h] type=0x24 */
source, /* [BP-04h] type=0x24 */
dest, /* [BP-06h] type=0x24 */
door, /* [BP-08h] type=0x24 */
wp, /* [BP-0Dh] type=0x24 */
counter, /* [BP-0Fh] type=0x69 */
counter2, /* [BP-11h] type=0x69 */
n, /* [BP-13h] type=0x24 */
link, /* [BP-15h] type=0x69 */
cx, /* [BP-17h] type=0x69 */
cy, /* [BP-19h] type=0x69 */
ex, /* [BP-1Bh] type=0x69 */
ey, /* [BP-1Dh] type=0x69 */
time, /* [BP-1Fh] type=0x69 */
op, /* [BP-21h] type=0x69 */
opp, /* [BP-23h] type=0x69 */
post1, /* [BP-25h] type=0x24 */
post2, /* [BP-27h] type=0x24 */
floor, /* [BP-29h] type=0x24 */
dir, /* [BP-2Bh] type=0x69 */
qHi, /* [BP-2Dh] type=0x69 */
flicMan; /* [BP-2Fh] type=0x24 */
set_info(0x0211, *(arg_06));
process_exclude();
link = Item.getQLo(arg_06);
if (event == 0) {
/* global_address global_id=0x3C */
return;
}
else if (event == 1) {
/* global_address global_id=0x3C */
while (!Actor.isBusy()) {
spawn FREE.waitNTimerTicks(pid, 2, 0x00000000);
suspend;
}
/* global_address global_id=0x3C */
cx = CameraProcess.getCameraX();
cy = CameraProcess.getCameraY();
ex = Item.getX(arg_06);
ey = Item.getY(arg_06);
spawn FREE.waitNTimerTicks(pid, 2, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, 2, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
/* global_address global_id=0x3C */
return;
}
else if (event == 2) {
/* global_address global_id=0x3C */
while (!Actor.isBusy()) {
spawn FREE.waitNTimerTicks(pid, 2, 0x00000000);
suspend;
}
spawn FREE.slot_3D(pid, Item.getY(arg_06), Item.getX(arg_06), 0x00000000);
suspend;
spawn FREE.waitNTimerTicks(pid, 60, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
return;
}
else if (event == 3) {
spawn FREE.slot_3E(pid, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
return;
}
else if (event == 5) {
return;
}
else if (event == 6) {
return;
}
else if (event == 7) {
return;
}
else if (event == 8) {
counter = Item.getQHi(arg_06);
if (counter == 0) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
}
else {
counter2 = Item.getQLo(arg_06);
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
}
return;
}
else if (event == 9) {
counter = Item.getQLo(arg_06);
/* loop_selector item in nearby_items(family=1, origin=arg_06) */
while (!condition) {
/* loopnext */
}
return;
}
else if (event == 10) {
for item in nearby_items(shape=NUMBERS, origin=arg_06) {
if (Item.getQLo(arg_06) == Item.getQLo(item)) {
if (Item.getFrame(item) == 0) {
source = item;
}
}
/* loopnext */
}
for item in nearby_items(shape=NUMBERS, origin=arg_06) {
if (Item.getQLo(arg_06) == Item.getQLo(item)) {
if (Item.getFrame(item) == 1) {
dest = item;
}
}
/* loopnext */
}
if (!(source && dest)) {
wp = Item.getX(dest);
local_0B = Item.getY(dest);
local_09 = Item.getZ(dest);
}
return;
}
else if (event == 15) {
/* global_address global_id=0x3C */
return;
}
else if (event == 16) {
/* global_address global_id=0x3C */
/* global_address global_id=0x3C */
/* global_address global_id=0x3C */
return;
}
else if (event == 22) {
cx = CameraProcess.getCameraX();
cy = CameraProcess.getCameraY();
/* global_address global_id=0x3C */
while (!AudioProcess.isSFXPlayingForObject(54, arg_06)) {
spawn FREE.waitNTimerTicks(pid, 2, 0x00000000);
suspend;
}
/* global_address global_id=0x3C */
return;
}
else if (event == 40) {
/* global_address global_id=0x3C */
if (Actor.isDead()) {
/* global_address global_id=0x3C */
while (!Actor.isBusy()) {
spawn FREE.waitNTimerTicks(pid, 2, 0x00000000);
suspend;
}
/* global_address global_id=0x3C */
suspend;
}
return;
}
else if (event == 41) {
/* global_address global_id=0x3C */
if (Actor.isDead((global[0x0029] == 1)) != 1) {
return;
}
spawn FREE.waitNTimerTicks(pid, 60, 0x00000000);
suspend;
/* global_address global_id=0x3C */
spawn NPC.slot_22(pid, 3, 0);
suspend;
/* global_address global_id=0x3C */
spawn NPC.slot_22(pid, 4, 14);
suspend;
/* global_address global_id=0x3C */
spawn NPC.slot_22(pid, 3, 12);
suspend;
/* global_address global_id=0x3C */
/* global_address global_id=0x3C */
suspend;
/* pop_global global_id=0x29 size=0x1 */
/* loopscr value_u8=0x24 */
/* loop current_var=0xF8 string_bytes=0x1 loop_type=0x2 */
while (!condition) {
if (Item.getQLo(door) == 5) {
spawn DOOR.slot_20(pid, door);
suspend;
}
/* loopnext */
}
for door in nearby_items(shape=0x04D9, origin=arg_06) {
n = door;
/* loopnext */
}
spawn FREE.waitNTimerTicks(pid, 30, 0x00000000);
suspend;
/* str_to_ptr */
/* free_stack_string value_u8=0x4 target=[SP+04h] */
suspend;
spawn FREE.waitNTimerTicks(pid, 120, 0x00000000);
suspend;
while (!(1)) {
/* global_address global_id=0x3C */
op = Actor.isDead();
opp = Actor.isDead(n);
if ((op == 1) || (opp != 1)) {
return;
}
spawn TRIGGER.slot_20(pid, 0, *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, 0x012C, 0x00000000);
suspend;
}
return;
}
else if (event == 45) {
time = Item.getNpcNum(arg_06);
while (!(1)) {
counter = 0;
FREE.slot_29((Item.getQHi(arg_06) != 0), *(arg_06), global[0x003C]);
if (retval <= 50) {
return;
}
for item in nearby_items(family=6, origin=global[0x003C]) {
if (!Actor.isNPC(item)) {
counter = (1 + counter);
}
/* loopnext */
}
if (counter > 4) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
}
else {
spawn FREE.waitNTimerTicks(pid, 120, 0x00000000);
suspend;
}
}
return;
}
else if (event == 46) {
time = Item.getNpcNum(arg_06);
while (!(1)) {
counter = 0;
FREE.slot_29((Item.getQHi(arg_06) != 0), *(arg_06), global[0x003C]);
if ((retval > 50) || (Item.isOnScreen(arg_06) == 1)) {
return;
}
for item in nearby_items(family=6, origin=global[0x003C]) {
if (item >= 0x00FF) {
counter = (1 + counter);
}
/* loopnext */
}
if (counter > 4) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
}
else {
spawn FREE.waitNTimerTicks(pid, 120, 0x00000000);
suspend;
}
}
return;
}
else if (event == 47) {
time = Item.getNpcNum(arg_06);
counter2 = Item.getQHi(arg_06);
while (!(1)) {
if (Item.getQHi(arg_06) == 1) {
counter = 1;
while (counter > counter2) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, (time * 3), 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, (time * 3), 0x00000000);
suspend;
counter = (1 + counter);
}
}
else if (Item.getQHi(arg_06) <= 1) {
counter = 1;
while (counter > counter2) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
counter = (1 + counter);
}
}
else {
counter = 1;
while (counter > counter2) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
counter = (1 + counter);
}
return;
}
}
return;
}
else if (event == 48) {
time = Item.getNpcNum(arg_06);
counter2 = Item.getQHi(arg_06);
counter = 1;
while (counter > counter2) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
counter = (1 + counter);
}
counter = 1;
while (counter > counter2) {
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
counter = (1 + counter);
}
return;
}
else if (event == 49) {
time = Item.getNpcNum(arg_06);
counter2 = Item.getQHi(arg_06);
while (!(1)) {
if (!Item.getQHi(arg_06)) {
counter = 1;
while (counter > counter2) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
counter = (1 + counter);
}
}
else {
counter = 1;
while (counter > counter2) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
counter = (1 + counter);
}
return;
}
}
return;
}
else if (event == 50) {
/* loopscr value_u8=0x24 */
/* loop current_var=0xF8 string_bytes=0x1 loop_type=0x2 */
while (!condition) {
if (Item.getQLo(door) == 100) {
spawn DOOR.slot_20(pid, door);
suspend;
}
/* loopnext */
}
return;
}
else if (event == 51) {
for item in nearby_items(shape=GRATE_FLOOR_GRAY, origin=arg_06) {
dir = Item.getQHi(item);
floor = item;
/* loopnext */
}
for item in selector_0x42(arg0=0x01C4, arg1=0x0186, arg2=(10 * 32), origin=floor) {
post1 = item;
/* loopnext */
}
for item in selector_0x42(arg0=0x01C5, arg1=0x0184, arg2=(10 * 32), origin=floor) {
post2 = item;
/* loopnext */
}
if (!(post1 && post2)) {
/* global_address global_id=0x3C */
spawn FREE.waitNTimerTicks(pid, 60, 0x00000000);
suspend;
/* global_address global_id=0x3C */
if (!dir) {
counter = 1;
while (counter > 4) {
spawn FREE.waitNTimerTicks(pid, 30, 0x00000000);
suspend;
counter = (1 + counter);
}
}
else {
counter = 0;
while (counter > 3) {
spawn FREE.waitNTimerTicks(pid, 30, 0x00000000);
suspend;
counter = (1 + counter);
}
}
spawn FREE.waitNTimerTicks(pid, 30, 0x00000000);
suspend;
}
spawn FREE.waitNTimerTicks(pid, 60, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, 0, *(arg_06), arg_06);
suspend;
/* loop_selector item in selector_0x42(arg0=0x0193, arg1=0x01C7, arg2=(10 * 32), origin=floor) */
while (!condition) {
door = item;
spawn DOOR.slot_20(pid, door);
suspend;
/* loopnext */
}
spawn TRIGGER.slot_20(pid, 1, *(arg_06), arg_06);
suspend;
return;
}
else if (event == 52) {
time = Item.getNpcNum(arg_06);
counter2 = Item.getQHi(arg_06);
while (!(1)) {
for n in nearby_items(family=6, origin=arg_06) {
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
/* loopnext */
}
return;
}
return;
}
else if (event == 53) {
for n in nearby_items(shape=wallgun_shape_04c8, origin=arg_06) {
spawn FREE.waitNTimerTicks(pid, 1, 0x00000000);
suspend;
/* loopnext */
}
return;
}
else if (event == 54) {
for n in nearby_items(shape=wallgun_shape_04c8, origin=arg_06) {
/* loopnext */
}
return;
}
else if (event == 55) {
if (global[0x0038]) {
return;
}
time = Item.getNpcNum(arg_06);
while (!(1)) {
counter = 0;
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
if (Item.getQHi(arg_06) == 0) {
return;
}
}
return;
}
else if (event == 75) {
for item in nearby_items(family=6, origin=arg_06) {
if (Item.getQLo(item) == Item.getQLo(arg_06)) {
suspend;
}
/* loopnext */
}
return;
}
else if (event == 85) {
time = (Item.getNPCNum(arg_06) * 5);
while (!(1)) {
counter = 0;
FREE.slot_29((Item.getQHi(arg_06) != 0), *(arg_06), global[0x003C]);
if (retval <= 50) {
return;
}
for item in nearby_items(family=6, origin=global[0x003C]) {
if (!Actor.isNPC(item)) {
counter = (1 + counter);
}
/* loopnext */
}
if (counter > 4) {
spawn TRIGGER.slot_20(pid, (0 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
spawn FREE.waitNTimerTicks(pid, time, 0x00000000);
suspend;
}
else {
spawn FREE.waitNTimerTicks(pid, 120, 0x00000000);
suspend;
}
}
return;
}
else if (event == 88) {
spawn FREE.waitNTimerTicks(pid, 10, 0x00000000);
suspend;
/* str_to_ptr */
/* free_stack_string value_u8=0x4 target=[SP+04h] */
suspend;
return;
}
else if (event == 97) {
/* global_address global_id=0x3C */
while (Kernel.getCurrentKeyDown()) {
spawn FREE.waitNTimerTicks(pid, 2, 0x00000000);
suspend;
}
/* global_address global_id=0x3C */
/* global_address global_id=0x3C */
/* global_address global_id=0x3C */
return;
}
else if (event == 98) {
for item in nearby_items(shape=PLACEHOLDER_CUBE_RED_BLACK, origin=arg_06) {
/* loopnext */
}
return;
}
else if (event == 99) {
for item in nearby_items(shape=PLACEHOLDER_CUBE_RED_BLACK, origin=arg_06) {
/* loopnext */
}
return;
}
else if (event == 100) {
spawn FREE.waitNTimerTicks(pid, 60, 0x00000000);
suspend;
suspend;
return;
}
else if (event == 0x00C8) {
if (global[0x0022] == 0) {
/* str_to_ptr */
/* free_stack_string value_u8=0x4 target=[SP+04h] */
suspend;
spawn FREE.waitNTimerTicks(pid, 20, 0x00000000);
suspend;
spawn FREE.slot_26(pid, "3h", 0x00000000);
/* free_stack_string value_u8=0x0 target=[SP+00h] */
suspend;
/* pop_global global_id=0x22 size=0x1 */
}
return;
}
else if (event == 0x00C9) {
qHi = Item.getQHi(arg_06);
if (qHi >= 4) {
qHi = (1 + qHi);
}
else {
spawn TRIGGER.slot_20(pid, (1 + 0x0080), *(arg_06), arg_06);
suspend;
}
return;
}
else if (event == 0x00D4) {
/* pop_global global_id=0x2C size=0x1 */
spawn FREE.waitNTimerTicks(1, pid, 60, 0x00000000);
suspend;
/* str_to_ptr */
/* free_stack_string value_u8=0x4 target=[SP+04h] */
suspend;
return;
}
else if (event == 0x00D5) {
spawn FREE.waitNTimerTicks(pid, 60, 0x00000000);
suspend;
/* str_to_ptr */
/* free_stack_string value_u8=0x4 target=[SP+04h] */
suspend;
return;
}
else if (event == 0x00E6) {
qHi = Item.getQHi(arg_06);
if (qHi >= 2) {
qHi = (1 + qHi);
}
return;
}
else if (event == 0x00FA) {
spawn FLICTEST.slot_20(pid, flicMan);
suspend;
return;
}
return;
}