Crusader_Decomp/USECODE/EUSECODE_extracted/pseudocode/SSWITCHE/slot_01_use.txt

157 lines
3.7 KiB
Text

function sswitche_use() /* entry=248 class_id=0x0457 slot=0x01 */
{
var
referent, /* [BP+00h] type=0x69 */
a, /* [BP-01h] type=0x62 */
b, /* [BP-02h] type=0x62 */
a1, /* [BP-03h] type=0x62 */
b1, /* [BP-04h] type=0x62 */
c1, /* [BP-05h] type=0x62 */
sswitch, /* [BP-07h] type=0x24 */
switch1, /* [BP-09h] type=0x24 */
switch2, /* [BP-0Bh] type=0x24 */
switch3, /* [BP-0Dh] type=0x24 */
timer, /* [BP-0Fh] type=0x24 */
sswitch2, /* [BP-11h] type=0x24 */
switch21, /* [BP-13h] type=0x24 */
switch22, /* [BP-15h] type=0x24 */
switch23, /* [BP-17h] type=0x24 */
counter, /* [BP-19h] type=0x69 */
qLo; /* [BP-1Bh] type=0x69 */
set_info(0x0207, *(arg_06));
process_exclude();
a = Item.getFrame(arg_06);
if (Item.getMapArray(arg_06) == 0) {
if (a == 2) {
spawn TRIGGER.slot_20(pid, 0, *(arg_06), arg_06);
suspend;
}
else if (a >= 2) {
b = ((a + 1) & 1);
spawn TRIGGER.slot_20(pid, a, *(arg_06), arg_06);
suspend;
}
}
else {
qLo = Item.getQLo(arg_06);
/* loop_selector sswitch in nearby_items(shape=0x0457, origin=arg_06) */
while (!condition) {
if (!(sswitch == *(arg_06))) {
if (Item.getMapArray(sswitch) == 0) {
if (Item.getQLo(sswitch) == 29) {
switch1 = sswitch;
a1 = Item.getFrame(switch1);
}
else if (Item.getQLo(sswitch) == 30) {
switch2 = sswitch;
b1 = Item.getFrame(switch2);
}
else if (Item.getQLo(sswitch) == 31) {
switch3 = sswitch;
c1 = Item.getFrame(switch3);
}
}
}
counter = (1 + counter);
/* loopnext */
}
for sswitch2 in nearby_items(shape=0x0452, origin=arg_06) {
if (Item.getMapArray(sswitch2) == 0) {
if (Item.getQLo(sswitch2) == 29) {
switch21 = sswitch2;
}
else if (Item.getQLo(sswitch2) == 30) {
switch22 = sswitch2;
}
else if (Item.getQLo(sswitch2) == 31) {
switch23 = sswitch2;
}
}
/* loopnext */
}
if (qLo == 29) {
a1 = Item.getFrame(arg_06);
switch1 = *(arg_06);
if (!(switch2 && switch3)) {
if (!a1) {
a1 = 0;
b1 = 1;
}
else {
a1 = 1;
b1 = 0;
}
}
}
else if (qLo == 30) {
b1 = Item.getFrame(arg_06);
switch2 = *(arg_06);
if (!(switch1 && switch3)) {
if (!b1) {
b1 = 0;
a1 = 1;
c1 = 1;
}
else {
b1 = 1;
a1 = 0;
c1 = 0;
}
}
}
else if (qLo == 31) {
c1 = Item.getFrame(arg_06);
switch3 = *(arg_06);
if (!(switch1 && switch2)) {
if (!c1) {
c1 = 0;
b1 = 1;
}
else {
c1 = 1;
b1 = 0;
}
}
}
if (!a1) {
if (!(b1 || c1)) {
return;
}
else {
for timer in nearby_items(shape=0x04C9, origin=arg_06) {
if (Item.getQLo(timer) == 29) {
suspend;
}
/* loopnext */
}
}
}
else if (!b1) {
if (!c1) {
return;
}
else {
for timer in nearby_items(shape=0x04C9, origin=arg_06) {
if (Item.getQLo(timer) == 30) {
suspend;
}
/* loopnext */
}
}
}
else if (!c1) {
for timer in nearby_items(shape=0x04C9, origin=arg_06) {
if (Item.getQLo(timer) == 31) {
suspend;
}
/* loopnext */
}
}
spawn FREE.waitNTimerTicks(pid, 20, 0x00000000);
suspend;
}
spawn FREE.waitNTimerTicks(pid, 20, 0x00000000);
suspend;
return;
}