From ab9f606371a1df23e9cacbffa0811db7a9e50100 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Sun, 8 Jun 2025 02:16:45 -0300 Subject: more `cract.cc` functions --- reference/game.c | 365 ------------------------------------------------------- 1 file changed, 365 deletions(-) (limited to 'reference') diff --git a/reference/game.c b/reference/game.c index 0a5a2e5..fec668b 100644 --- a/reference/game.c +++ b/reference/game.c @@ -43304,239 +43304,6 @@ void __static_initialization_and_destruction_0(int __initialize_p,int __priority return; } -// DWARF original prototype: void Go(TCreature * this, int x, int y, int z) - -void __thiscall TCreature::Go(TCreature *this,int x,int y,int z) - -{ - TSkill *pTVar1; - bool bVar2; - uint uVar3; - int iVar4; - CreatureType CVar5; - undefined4 *puVar6; - int iVar7; - int iVar8; - int iVar9; - int *piVar10; - int iVar11; - int Delay; - int dy; - int local_54; - int local_50; - Object local_4c [4]; - Object local_3c [4]; - Object local_2c [7]; - - if (z == this->posz) { - uVar3 = x - this->posx; - if (0x7fffffff < uVar3) { - uVar3 = -uVar3; - } - if ((int)uVar3 < 2) { - uVar3 = y - this->posy; - if (0x7fffffff < uVar3) { - uVar3 = -uVar3; - } - if ((int)uVar3 < 2) { - pTVar1 = (this->super_TSkillBase).Skills[0x14]; - if (((pTVar1 != (TSkill *)0x0) && - (iVar8 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1), 0 < iVar8)) && - (iVar8 = TSkill::Get((this->super_TSkillBase).Skills[0x14]), iVar8 == 0)) { - iVar8 = rand(); - pTVar1 = (this->super_TSkillBase).Skills[0x14]; - iVar9 = (*pTVar1->_vptr_TSkill[0xd])(pTVar1); - if (iVar8 % (7 - iVar9) == 0) { - Delay = 0; - iVar9 = 0; - iVar8 = rand(); - iVar8 = iVar8 % 4; - if (iVar8 == 1) { - iVar9 = -1; - } - else if (iVar8 < 2) { - if (iVar8 == 0) { - iVar9 = 1; - } - } - else if (iVar8 == 2) { - Delay = 1; - iVar9 = 0; - } - else if (iVar8 == 3) { - Delay = -1; - iVar9 = 0; - } - x = iVar9 + this->posx; - y = Delay + this->posy; - bVar2 = ToDoClear(this); - if ((bVar2) && (this->Type == PLAYER)) { - SendSnapback(this->Connection); - } - ToDoTalk(this); - if (this->NrToDo != 0) { - this->LockToDo = true; - this->ActToDo = 0; - local_50 = CalculateDelay(this); - local_54 = 1; - piVar10 = &local_54; - if (0 < local_50) { - piVar10 = &local_50; - } - iVar8 = *piVar10; - priority_queue<>::insert(&ToDoQueue); - this->NextWakeup = iVar8 + ServerMilliseconds; - } - } - } - // try { // try from 080bf247 to 080bf65d has its CatchHandler @ 080bf6b8 - iVar9 = x; - iVar8 = y; - iVar11 = z; - iVar4 = (*this->_vptr_TCreature[3])(this,x,y,z,1,0); - if ((char)iVar4 != '\0') goto LAB_080bf2f7; - if (this->Type == PLAYER) { - CVar5 = PLAYER; - if (0 < z) { - iVar8 = this->posz; - iVar9 = this->posy; - iVar4 = GetHeight(); - if (0x17 < iVar4) { - if (this->posx == x) { - iVar4 = this->posy; - } - else { - iVar4 = this->posy; - if (iVar4 != y) goto LAB_080bf2a4; - } - iVar11 = 0; - iVar7 = z + -1; - iVar8 = iVar7; - bVar2 = CoordinateFlag(); - iVar9 = iVar4; - if (!bVar2) { - iVar11 = 0x20; - iVar9 = this->posy; - iVar8 = iVar7; - bVar2 = CoordinateFlag(); - if ((!bVar2) && - (iVar9 = x, iVar8 = y, iVar11 = iVar7, - iVar4 = (*this->_vptr_TCreature[3])(this,x,y,iVar7,1,1), - (char)iVar4 != '\0')) { - z = iVar7; - } - } - } -LAB_080bf2a4: - CVar5 = this->Type; - } - if ((CVar5 == PLAYER) && (z < 0xf)) { - iVar4 = z + 1; - iVar9 = y; - iVar8 = iVar4; - iVar7 = GetHeight(); - if ((0x17 < iVar7) && ((this->posx == x || (this->posy == y)))) { - iVar11 = 0; - iVar9 = y; - iVar8 = z; - bVar2 = CoordinateFlag(); - if (!bVar2) { - iVar11 = 0x20; - iVar9 = y; - iVar8 = z; - bVar2 = CoordinateFlag(); - if ((!bVar2) && - (iVar9 = x, iVar8 = y, iVar11 = iVar4, - iVar7 = (*this->_vptr_TCreature[3])(this,x,y,iVar4,1,1), - (char)iVar7 != '\0')) { - z = iVar4; - } - } - } - } - } - if ((z != this->posz) && - (iVar9 = x, iVar8 = y, iVar4 = (*this->_vptr_TCreature[3])(this,x,y,z,1,1), - iVar11 = z, (char)iVar4 != '\0')) { -LAB_080bf2f7: - local_2c[0].ObjectID = ::NONE.ObjectID; - GetMapContainer((int)local_3c,x,y); - local_4c[0].ObjectID = (this->CrObject).ObjectID; - ::Move(this->ID,local_4c,local_3c,-1,false,local_2c); - return; - } - puVar6 = (undefined4 *)__cxa_allocate_exception(4,iVar9,iVar8,iVar11); - *puVar6 = 0x34; - goto LAB_080bf372; - } - } - } - puVar6 = (undefined4 *)__cxa_allocate_exception(4); - *puVar6 = 1; -LAB_080bf372: - // WARNING: Subroutine does not return - __cxa_throw(puVar6,&RESULT::typeinfo,0); -} - - - -// DWARF original prototype: void Rotate(TCreature * this, uchar Dir) - -void __thiscall TCreature::Rotate(TCreature *this,uchar Dir) - -{ - Object local_1c [6]; - - local_1c[0].ObjectID = (this->CrObject).ObjectID; - this->Direction = (uint)Dir; - AnnounceChangedObject(local_1c,2); - return; -} - - - -// DWARF original prototype: void Rotate(TCreature * this, TCreature * Target) - -void __thiscall TCreature::Rotate(TCreature *this,TCreature *Target) - -{ - uint uVar1; - int dy; - uint uVar2; - int iVar3; - int dx; - int iVar4; - Object local_1c [4]; - - if (Target == (TCreature *)0x0) { - error("TCreature::Rotate: Target ist NULL.\n"); - } - else { - iVar4 = Target->posx - this->posx; - uVar2 = Target->posy - this->posy; - iVar3 = -iVar4; - if (-1 < iVar4) { - iVar3 = iVar4; - } - uVar1 = -uVar2; - if (-1 < (int)uVar2) { - uVar1 = uVar2; - } - if (iVar3 < (int)uVar1) { - uVar2 = ((int)~uVar2 >> 0x1f) * -2; - } - else { - uVar2 = (iVar4 >> 0x1f) * -2 + 1; - } - local_1c[0].ObjectID = (this->CrObject).ObjectID; - this->Direction = uVar2 & 0xff; - AnnounceChangedObject(local_1c,2); - } - return; -} - - - // DWARF original prototype: void Move(TCreature * this, Object * Obj, int zx, int zy, int zz, uchar // Count) @@ -44509,138 +44276,6 @@ LAB_080c12f2: return; } -// DWARF original prototype: void Execute(TCreature * this) - -void __thiscall TCreature::Execute(TCreature *this) - -{ - bool bVar1; - int iVar2; - TToDoEntry *pTVar3; - undefined4 *puVar4; - char *Addressee; - int Delay; - int Delay_1; - char *pcVar5; - bool SnapbackNecessary; - TToDoEntry TD_1; - Object local_5c [4]; - Object local_4c [4]; - ToDoType local_3c; - TToDoEntry TD; - - do { - if (this->LockToDo == false) { - return; - } - if (this->IsDead != false) { - return; - } - if (ServerMilliseconds < this->NextWakeup) { - return; - } - if (this->NrToDo <= this->ActToDo) { - ToDoClear(this); - (*this->_vptr_TCreature[8])(this); - return; - } - iVar2 = CalculateDelay(this); - if (0 < iVar2) { - if (this->Stop == false) { - priority_queue<>::insert(&ToDoQueue); - this->NextWakeup = iVar2 + ServerMilliseconds; - return; - } - ToDoClear(this); - if (this->Type != PLAYER) { - return; - } - SendSnapback(this->Connection); - return; - } - pTVar3 = vector::operator()(&this->ToDoList,this->ActToDo); - local_3c = pTVar3->Code; - TD.Code = (pTVar3->field_1).Move.Obj; - TD.field_1.Wait.Time = - (anon_struct_4_1_898373eb_for_Wait)*(ToDoType *)((int)&pTVar3->field_1 + 4); - TD.field_1.Go.y = *(int *)((int)&pTVar3->field_1 + 8); - TD.field_1.Go.z = *(int *)((int)&pTVar3->field_1 + 0xc); - TD.field_1.Move.z = *(int *)((int)&pTVar3->field_1 + 0x10); - this->ActToDo = this->ActToDo + 1; - switch(local_3c) { - case TDGo: - // try { // try from 080c1bb6 to 080c1ca3 has its CatchHandler @ 080c2050 - Go(this,TD.Code,TD.field_1.Go.x,TD.field_1.Go.y); - break; - case TDRotate: - local_4c[0].ObjectID = (this->CrObject).ObjectID; - this->Direction = TD.Code & 0xff; - AnnounceChangedObject(local_4c,2); - break; - case TDMove: - local_4c[0].ObjectID = TD.Code; - Move(this,local_4c,TD.field_1.Go.x,TD.field_1.Go.y,TD.field_1.Go.z, - (uchar)TD.field_1.Move.z); - break; - case TDTrade: - local_4c[0].ObjectID = TD.Code; - Trade(this,local_4c,TD.field_1.Move.Obj); - break; - case TDUse: - local_5c[0].ObjectID = TD.Code; - local_4c[0].ObjectID = (ulong)TD.field_1.Wait.Time; - Use(this,local_5c,local_4c,(uchar)TD.field_1.Trade.Partner); - break; - case TDTurn: - local_5c[0].ObjectID = TD.Code; - // try { // try from 080c1cb5 to 080c1d07 has its CatchHandler @ 080c1e43 - bVar1 = Object::exists(local_5c); - if (!bVar1) { - puVar4 = (undefined4 *)__cxa_allocate_exception(4); - *puVar4 = 0x1f; - // WARNING: Subroutine does not return - __cxa_throw(puVar4,&RESULT::typeinfo,0); - } - local_4c[0].ObjectID = local_5c[0].ObjectID; - ::Turn(this->ID,local_4c); - break; - case TDAttack: - // try { // try from 080c1d11 to 080c1d15 has its CatchHandler @ 080c1e43 - TCombat::Attack(&this->Combat); - break; - case TDTalk: - if (TD.Code == TDWait) { - pcVar5 = "TCreature::Execute: TD.Text ist Null bei %s.\n"; -LAB_080c1d33: - // try { // try from 080c1d33 to 080c1dc3 has its CatchHandler @ 080c2050 - error(pcVar5,this->Name); - } - else { - pcVar5 = GetDynamicString(TD.Code); - if (pcVar5 == (char *)0x0) { - pcVar5 = "TCreature::Execute: Text ist NULL bei %s.\n"; - goto LAB_080c1d33; - } - } - pcVar5 = GetDynamicString(TD.Code); - Addressee = GetDynamicString(TD.field_1.Trade.Partner); - Talk(this->ID,TD.field_1.Go.x,Addressee,pcVar5,SUB41(TD.field_1.Go.z,0)); - break; - case TDChangeState: - if (this->Type == NPC) { - ChangeNPCState(this,TD.Code,true); - } - } - if (this->Stop != false) { - ToDoClear(this); - if (this->Type == PLAYER) { - SendSnapback(this->Connection); - } - return; - } - } while( true ); -} - // WARNING: Unknown calling convention -- yet parameter storage is locked void _GLOBAL__I__ZN9TShortwayC2EP9TCreatureii(void) -- cgit v1.2.3