private int OperatorAll1(int op) { int a = 0; int valueAtOffset = this.gCP.getValueAtOffset(-2); int num; if ((valueAtOffset >> 26 & 7) == 5) { num = this.GetSysList(valueAtOffset); } else { this.gCP.retreatTopOfStack(); num = this.eBin.getv(); this.gCP.advanceTopOfStack(); this.gCP.advanceTopOfStack(); } EBin.op_binary opBinary = (EBin.op_binary)op; for (int index = 0; index < 8; ++index) { if ((num & 1) != 0) { this.gMemberTarget = this._objPtrList[index]; switch (opBinary) { case EBin.op_binary.B_POST_PLUS_A: a = this.eBin.getv(); this.gCP.advanceTopOfStack(); this.eBin.putv(a + 1); break; case EBin.op_binary.B_POST_MINUS_A: a = this.eBin.getv(); this.gCP.advanceTopOfStack(); this.eBin.putv(a - 1); break; case EBin.op_binary.B_PRE_PLUS_A: a = this.eBin.getv() + 1; this.gCP.advanceTopOfStack(); this.eBin.putv(a); break; case EBin.op_binary.B_PRE_MINUS_A: a = this.eBin.getv() - 1; this.gCP.advanceTopOfStack(); this.eBin.putv(a); break; } this.gCP.advanceTopOfStack(); } num >>= 1; } this.gCP.retreatTopOfStack(); this.gCP.retreatTopOfStack(); return(a); }
public Int32 OperatorExtract(Int32 op) { Int32 num1 = 0; Int32 num2 = 0; Int32 valueAtOffset = this.gCP.getValueAtOffset(-3); Int32 num3; if ((valueAtOffset >> 26 & 7) == 5) { num3 = this.GetSysList(valueAtOffset); } else { this.gCP.retreatTopOfStack(); this.gCP.retreatTopOfStack(); num3 = this.eBin.getv(); this.gCP.advanceTopOfStack(); this.gCP.advanceTopOfStack(); this.gCP.advanceTopOfStack(); } Int32 num4 = this.eBin.getv(); for (Int32 index = 0; index < 8; ++index) { num1 >>= 1; if ((num3 & 1) != 0) { this.gMemberTarget = this._objPtrList[index]; EBin.op_binary opBinary = (EBin.op_binary)op; switch (opBinary) { case EBin.op_binary.B_LT_E: num2 = this.eBin.getv() >= num4 ? 0 : 1; break; case EBin.op_binary.B_GT_E: num2 = this.eBin.getv() <= num4 ? 0 : 1; break; case EBin.op_binary.B_LE_E: num2 = this.eBin.getv() > num4 ? 0 : 1; break; case EBin.op_binary.B_GE_E: num2 = this.eBin.getv() < num4 ? 0 : 1; break; case EBin.op_binary.B_EQ_E: num2 = this.eBin.getv() != num4 ? 0 : 1; break; case EBin.op_binary.B_NE_E: num2 = this.eBin.getv() == num4 ? 0 : 1; break; default: switch (opBinary - 84) { case EBin.op_binary.B_PAD0: num2 = (this.eBin.getv() & num4) == 0 ? 0 : 1; break; case EBin.op_binary.B_PAD1: num2 = (this.eBin.getv() & num4) != 0 ? 0 : 1; break; case EBin.op_binary.B_PAD2: num2 = (this.eBin.getv() ^ num4) == 0 ? 0 : 1; break; case EBin.op_binary.B_PAD3: num2 = (this.eBin.getv() | num4) == 0 ? 0 : 1; break; } break; } num1 |= num2 << 7; this.gCP.advanceTopOfStack(); } num3 >>= 1; } this.gCP.retreatTopOfStack(); this.gCP.retreatTopOfStack(); return(num1); }
public int OperatorAll(int op) { int a = 0; int valueAtOffset = this.gCP.getValueAtOffset(-3); int num1; if ((valueAtOffset >> 26 & 7) == 5) { num1 = this.GetSysList(valueAtOffset); } else { this.gCP.retreatTopOfStack(); this.gCP.retreatTopOfStack(); num1 = this.eBin.getv(); this.gCP.advanceTopOfStack(); this.gCP.advanceTopOfStack(); this.gCP.advanceTopOfStack(); } int num2 = this.eBin.getv(); EBin.op_binary opBinary = (EBin.op_binary)op; for (int index = 0; index < 8; ++index) { if ((num1 & 1) != 0) { this.gMemberTarget = this._objPtrList[index]; switch (opBinary) { case EBin.op_binary.B_LET_A: a = num2; break; case EBin.op_binary.B_MULT_LET_A: a = this.eBin.getv() * num2; this.gCP.advanceTopOfStack(); break; case EBin.op_binary.B_DIV_LET_A: a = num2 == 0 ? this.eBin.getv() : this.eBin.getv() / num2; this.gCP.advanceTopOfStack(); break; case EBin.op_binary.B_REM_LET_A: a = num2 == 0 ? this.eBin.getv() : this.eBin.getv() % num2; this.gCP.advanceTopOfStack(); break; case EBin.op_binary.B_PLUS_LET_A: a = this.eBin.getv() + num2; this.gCP.advanceTopOfStack(); break; case EBin.op_binary.B_MINUS_LET_A: a = this.eBin.getv() - num2; this.gCP.advanceTopOfStack(); break; case EBin.op_binary.B_SHIFT_LEFT_LET_A: a = this.eBin.getv() << num2; this.gCP.advanceTopOfStack(); break; case EBin.op_binary.B_SHIFT_RIGHT_LET_A: a = this.eBin.getv() >> num2; this.gCP.advanceTopOfStack(); break; case EBin.op_binary.B_AND_LET_A: a = this.eBin.getv() & num2; this.gCP.advanceTopOfStack(); break; case EBin.op_binary.B_XOR_LET_A: a = this.eBin.getv() ^ num2; this.gCP.advanceTopOfStack(); break; case EBin.op_binary.B_OR_LET_A: a = this.eBin.getv() | num2; this.gCP.advanceTopOfStack(); break; } this.eBin.putv(a); this.gCP.advanceTopOfStack(); } num1 >>= 1; } this.gCP.retreatTopOfStack(); this.gCP.retreatTopOfStack(); return(a); }
public int DoCalcOperationExt(int code) { int frameNdx = 0; short triNdx1 = 0; short floorNdx1 = 0; EBin.op_binary opBinary = (EBin.op_binary)code; switch (opBinary) { case EBin.op_binary.B_HAVE_ITEM: int id = this.eBin.getv(); frameNdx = id >= EventEngine.kSItemOfs ? (id >= EventEngine.kCItemOfs ? QuadMistDatabase.MiniGame_GetCardCount(id - EventEngine.kCItemOfs) : (!ff9item.FF9Item_IsExistImportant(id - EventEngine.kSItemOfs) ? 0 : 1)) : ff9item.FF9Item_GetCount(id); break; case EBin.op_binary.B_BAFRAME: this.fieldmap.walkMesh.BGI_animGetFrame((uint)this.eBin.getv(), ref frameNdx); break; case EBin.op_binary.B_FRAME: frameNdx = EventEngineUtils.GetCharAnimFrame(this.gCur.go, this.eBin.getv()); break; case EBin.op_binary.B_SPS: this.eBin.getv(); this.eBin.getv(); break; case EBin.op_binary.B_CURMP: frameNdx = (int)this._ff9.player[this.chr2slot(this.eBin.getv())].cur.mp; break; case EBin.op_binary.B_MAXMP: frameNdx = (int)this._ff9.player[this.chr2slot(this.eBin.getv())].max.mp; break; case EBin.op_binary.B_BGIID: short triNdx2 = -1; BGI.BGI_charGetInfo(this.eBin.getv(), ref triNdx2, ref floorNdx1); frameNdx = (int)triNdx2; break; case EBin.op_binary.B_BGIFLOOR: short floorNdx2 = -1; BGI.BGI_charGetInfo(this.eBin.getv(), ref triNdx1, ref floorNdx2); frameNdx = (int)floorNdx2; break; default: switch (opBinary - 67) { case EBin.op_binary.B_PAD0: case EBin.op_binary.B_PAD1: case EBin.op_binary.B_PAD2: label_9: frameNdx = this.OperatorExtractLet(code); break; case EBin.op_binary.B_POST_PLUS_A: case EBin.op_binary.B_POST_MINUS_A: label_8: frameNdx = this.OperatorExtract1(code); break; default: switch (opBinary - 8) { case EBin.op_binary.B_PAD0: case EBin.op_binary.B_PAD1: case EBin.op_binary.B_PAD2: case EBin.op_binary.B_PAD3: frameNdx = this.OperatorAll1(code); break; case EBin.op_binary.B_PRE_MINUS: goto label_8; default: switch (opBinary - 90) { case EBin.op_binary.B_PAD0: case EBin.op_binary.B_PAD1: case EBin.op_binary.B_PAD2: this.eBin.getv(); break; default: if (opBinary != EBin.op_binary.B_CURHP) { if (opBinary != EBin.op_binary.B_MAXHP) { if (opBinary == EBin.op_binary.B_LET_E) { goto label_9; } else { break; } } else { frameNdx = (int)this._ff9.player[this.chr2slot(this.eBin.getv())].max.hp; break; } } else { frameNdx = (int)this._ff9.player[this.chr2slot(this.eBin.getv())].cur.hp; break; } } break; } break; } break; } return(frameNdx); }