From d2eb32efe2df9e570e491b08d4ecf50da35f1b75 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Mon, 2 Jun 2025 18:17:10 -0300 Subject: impl some spells and create `info.cc` --- reference/game.c | 629 ------------------------------------------------------- 1 file changed, 629 deletions(-) (limited to 'reference/game.c') diff --git a/reference/game.c b/reference/game.c index 2062902..138c00e 100644 --- a/reference/game.c +++ b/reference/game.c @@ -13686,61 +13686,6 @@ int GetHeight(void) return iVar3; } - - -bool JumpPossible(int x,int y,int z,bool AvoidPlayers) - -{ - bool bVar1; - TCreature *pTVar2; - bool local_4e; - bool BankThere; - Object OStack_4c; - bool AvoidPlayers_local; - Object local_3c [4]; - ulong local_2c; - Object Obj; - - GetFirstObject(); - local_4e = false; - if (local_2c != NONE.ObjectID) { - local_4e = false; - if (local_2c != NONE.ObjectID) { - do { - OStack_4c.ObjectID = NONE.ObjectID; - local_3c[0].ObjectID = NONE.ObjectID; - Object::getObjectType(&stack0xffffffb4); - bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,BANK); - if (bVar1) { - local_4e = true; - } - Object::getObjectType(&stack0xffffffb4); - bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,UNPASS); - if (bVar1) { - Object::getObjectType(&stack0xffffffb4); - bVar1 = ObjectType::getFlag((ObjectType *)&stack0xffffffb4,UNMOVE); - if (bVar1) { - return false; - } - } - if ((AvoidPlayers) && - (Object::getObjectType(&stack0xffffffb4), OStack_4c.ObjectID == 99)) { - OStack_4c.ObjectID = local_2c; - pTVar2 = GetCreature(&stack0xffffffb4); - if ((pTVar2 != (TCreature *)0x0) && (pTVar2->Type == PLAYER)) { - return false; - } - } - Object::getNextObject(local_3c); - local_2c = local_3c[0].ObjectID; - } while (local_3c[0].ObjectID != NONE.ObjectID); - } - } - return local_4e; -} - - - // WARNING: Unknown calling convention -- yet parameter storage is locked bool FieldPossible(void) @@ -13803,87 +13748,6 @@ LAB_080701d5: } - -// WARNING: Variable defined which should be unmapped: HouseID_local - -bool SearchFreeField(int *x,int *y,int *z,int Distance,ushort HouseID,bool Jump) - -{ - bool bVar1; - bool bVar2; - ushort uVar3; - int local_28; - int dy; - int dx; - int Dist; - int Direction; - bool Jump_local; - ushort HouseID_local; - - local_28 = 0; - Dist = 4; - dx = 0; - dy = 0; - do { - if (Jump) { - bVar2 = JumpPossible(dy + *x,local_28 + *y,*z,true); -LAB_08070550: - if (bVar2 != false) { -LAB_080703ed: - if (((HouseID == 0xffff) || (bVar2 = IsHouse(dy + *x,local_28 + *y,*z), !bVar2)) || - ((HouseID != 0 && - (uVar3 = GetHouseID(dy + *x,local_28 + *y,*z), uVar3 == HouseID)))) { - *x = *x + dy; - *y = *y + local_28; - return true; - } - } - } - else { - bVar2 = false; - bVar1 = CoordinateFlag(); - if (bVar1) { - bVar2 = CoordinateFlag(); - bVar2 = !bVar2; - } - if (bVar2) { - bVar2 = CoordinateFlag(); - if (bVar2) { - bVar2 = CoordinateFlag(); - goto LAB_08070550; - } - goto LAB_080703ed; - } - } - if (Dist == 2) { - dy = dy + -1; - if (dy + dx == 0) { - Dist = 3; - } - } - else if ((uint)Dist < 3) { - if ((Dist == 1) && (local_28 = local_28 + -1, local_28 + dx == 0)) { - Dist = 2; - } - } - else if (Dist == 3) { - local_28 = local_28 + 1; - if (local_28 == dx) { - Dist = 4; - } - } - else if ((Dist == 4) && (dy = dy + 1, dy == dx + 1)) { - Dist = 1; - dx = dy; - } - if (Distance < dx) { - return false; - } - } while( true ); -} - - - bool SearchLoginField(int *x,int *y,int *z,int Distance,bool Player) { @@ -20988,499 +20852,6 @@ void __static_initialization_and_destruction_0(int __initialize_p,int __priority return; } -// WARNING: Unknown calling convention -- yet parameter storage is locked - -void CleanupField(void) - -{ - bool bVar1; - uint uVar2; - ulong uVar3; - undefined4 *puVar4; - TCreature *in_stack_00000004; - Object *in_stack_00000008; - int in_stack_0000000c; - int in_stack_00000010; - char *Text; - int local_58; - int x; - int y; - int z; - ulong local_3c; - Object Help; - Object local_2c [7]; - - if (in_stack_00000004 == (TCreature *)0x0) { - Text = &DAT_080fb140; - } - else { - // try { // try from 08081d70 to 08081fa5 has its CatchHandler @ 08081fc3 - bVar1 = Object::exists(in_stack_00000008); - if (bVar1) { - local_2c[0].ObjectID = in_stack_00000008->ObjectID; - GetObjectCoordinates(local_2c,&local_58,&x,&y); - if (y == in_stack_00000004->posz) { - uVar2 = local_58 - in_stack_00000004->posx; - if (0x7fffffff < uVar2) { - uVar2 = -uVar2; - } - if ((int)uVar2 < 2) { - uVar2 = x - in_stack_00000004->posy; - if (0x7fffffff < uVar2) { - uVar2 = -uVar2; - } - if ((int)uVar2 < 2) { - CheckMana(in_stack_00000004,in_stack_0000000c,in_stack_00000010,1000); - GetFirstObject(); - in_stack_00000008->ObjectID = local_3c; - if (local_3c != NONE.ObjectID) { - do { - local_2c[0].ObjectID = NONE.ObjectID; - Object::getNextObject((Object *)&z); - in_stack_00000008->ObjectID = z; - local_2c[0].ObjectID = z; - Object::getObjectType((Object *)&z); - bVar1 = ObjectType::getFlag((ObjectType *)&z,UNMOVE); - if ((!bVar1) && (Object::getObjectType((Object *)&z), z != 99)) { - Object::getObjectType((Object *)&z); - bVar1 = ObjectType::getFlag((ObjectType *)&z,CORPSE); - if (bVar1) { - Object::getObjectType((Object *)&z); - uVar3 = ObjectType::getAttribute - ((ObjectType *)&z,CORPSETYPE); - if (uVar3 == 0) goto LAB_08081e86; - } - z = local_3c; - Delete((Object *)&z,-1); - } -LAB_08081e86: - local_3c = in_stack_00000008->ObjectID; - } while (local_3c != NONE.ObjectID); - } - local_3c = NONE.ObjectID; - local_2c[0].ObjectID = NONE.ObjectID; - GraphicalEffect(); - TCreature::BlockLogout(in_stack_00000004,0x3c,true); - return; - } - } - } - puVar4 = (undefined4 *)__cxa_allocate_exception(4); - *puVar4 = 5; - goto LAB_08081f82; - } - Text = &DAT_080fb100; - } - error(Text); - puVar4 = (undefined4 *)__cxa_allocate_exception(4); - *puVar4 = 0xffffffff; -LAB_08081f82: - // WARNING: Subroutine does not return - __cxa_throw(puVar4,&RESULT::typeinfo,0); -} - - - -void CleanupField(TCreature *cr) - -{ - bool bVar1; - int y; - int iVar2; - undefined4 *puVar3; - char *Text; - undefined1 local_1c [16]; - - if (cr == (TCreature *)0x0) { - Text = &DAT_080fb140; - } - else { - if (cr->Type == PLAYER) { - // try { // try from 08082016 to 08082124 has its CatchHandler @ 08082130 - bVar1 = CheckRight(cr->ID,CLEANUP_FIELDS); - if (!bVar1) { - return; - } - iVar2 = cr->Direction; - if (iVar2 == 1) { - iVar2 = cr->posy; - y = cr->posx + 1; - } - else { - if (iVar2 < 2) { - if (iVar2 != 0) { - return; - } - iVar2 = cr->posy + -1; - } - else { - if (iVar2 != 2) { - if (iVar2 != 3) { - return; - } - iVar2 = cr->posy; - y = cr->posx + -1; - goto LAB_08082065; - } - iVar2 = cr->posy + 1; - } - y = cr->posx; - } -LAB_08082065: - GetMapContainer((int)local_1c,y,iVar2); - CleanupField(); - return; - } - Text = "CleanupField: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(Text); - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0xffffffff; - // WARNING: Subroutine does not return - __cxa_throw(puVar3,&RESULT::typeinfo,0); -} - - - -void Teleport(TCreature *cr,char *Param) - -{ - bool bVar1; - ushort HouseID; - int iVar2; - undefined4 *puVar3; - TConnection *Connection; - Object *Obj_00; - char *pcVar4; - int *piVar5; - Object *Ignore; - int local_68; - int x; - int y; - int z; - Object local_4c [4]; - Object local_3c [4]; - ulong local_2c; - Object Obj; - - if (cr == (TCreature *)0x0) { - pcVar4 = &DAT_080fb260; - } - else if (Param == (char *)0x0) { - pcVar4 = "Teleport: Param ist NULL.\n"; - } - else { - if (cr->Type == PLAYER) { - local_3c[0].ObjectID = (cr->CrObject).ObjectID; - local_2c = local_3c[0].ObjectID; - // try { // try from 080821ad to 0808270f has its CatchHandler @ 08082740 - GetObjectCoordinates(local_3c,&local_68,&x,&y); - iVar2 = stricmp(Param,"up",-1); - if (iVar2 != 0) { - iVar2 = stricmp(Param,"down",-1); - if (iVar2 == 0) { - bVar1 = CheckRight(cr->ID,TELEPORT_VERTICAL); - if (!bVar1) { - return; - } - y = y + 1; - bVar1 = SearchFreeField(&local_68,&x,&y,1,0xffff,true); - if (!bVar1) goto LAB_080822b7; - z = NONE.ObjectID; - GetMapContainer((int)local_4c,local_68,x); - } - else { - iVar2 = stricmp(Param,"fast",-1); - if (iVar2 == 0) { - bVar1 = CheckRight(cr->ID,MODIFY_GOSTRENGTH); - if (!bVar1) { - return; - } - iVar2 = 100; -LAB_080823f2: - TSkill::SetMDAct((cr->super_TSkillBase).Skills[4],iVar2); - AnnounceChangedCreature(cr->ID,4); - z = local_2c; - GraphicalEffect((Object *)&z,0xd); - return; - } - iVar2 = stricmp(Param,"fastest",-1); - if (iVar2 == 0) { - bVar1 = CheckRight(cr->ID,MODIFY_GOSTRENGTH); - if (!bVar1) { - return; - } - iVar2 = 200; - goto LAB_080823f2; - } - iVar2 = stricmp(Param,"slow",-1); - if ((iVar2 == 0) || (iVar2 = stricmp(Param,"normal",-1), iVar2 == 0)) { - bVar1 = CheckRight(cr->ID,MODIFY_GOSTRENGTH); - if (!bVar1) { - return; - } - iVar2 = 0; - goto LAB_080823f2; - } - piVar5 = &x; - iVar2 = sscanf(Param,"%d,%d,%d",&local_68,piVar5,&y); - if (iVar2 == 3) { -LAB_08082630: - bVar1 = CheckRight(cr->ID,TELEPORT_TO_COORDINATE); - if (!bVar1) { - return; - } - if ((((local_68 < 1) || (x < 1)) || (y < 1)) || - (bVar1 = IsOnMap(local_68,x,y), !bVar1)) { - bVar1 = IsOnMap(local_68 + cr->posx,x + cr->posy,y + cr->posz); - if (!bVar1) { - Connection = cr->Connection; - pcVar4 = "Invalid coordinates."; -LAB_0808257b: - SendMessage(Connection,0x17,pcVar4,piVar5); - return; - } - x = x + cr->posy; - local_68 = local_68 + cr->posx; - y = y + cr->posz; - } - HouseID = 0xffff; - } - else { - piVar5 = &x; - iVar2 = sscanf(Param,"[%d,%d,%d]",&local_68,piVar5,&y); - if (iVar2 == 3) goto LAB_08082630; - bVar1 = CheckRight(cr->ID,TELEPORT_TO_MARK); - if (!bVar1) { - return; - } - piVar5 = &y; - bVar1 = GetMarkPosition(); - if (!bVar1) { - Connection = cr->Connection; - pcVar4 = "There is no mark of this name."; - goto LAB_0808257b; - } - HouseID = GetHouseID(local_68,x,y); - } - bVar1 = SearchFreeField(&local_68,&x,&y,1,HouseID,true); - if (!bVar1) goto LAB_080822b7; - z = NONE.ObjectID; - GetMapContainer((int)local_4c,local_68,x); - } - Ignore = (Object *)&z; - Obj_00 = local_3c; - local_3c[0].ObjectID = local_2c; -LAB_08082285: - Move(0,Obj_00,local_4c,-1,false,Ignore); - GraphicalEffect(); - return; - } - bVar1 = CheckRight(cr->ID,TELEPORT_VERTICAL); - if (!bVar1) { - return; - } - y = y + -1; - bVar1 = SearchFreeField(&local_68,&x,&y,1,0xffff,true); - if (bVar1) { - local_3c[0].ObjectID = NONE.ObjectID; - GetMapContainer((int)local_4c,local_68,x); - Obj_00 = (Object *)&z; - Ignore = local_3c; - z = local_2c; - goto LAB_08082285; - } -LAB_080822b7: - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 4; - goto LAB_080822c9; - } - pcVar4 = "Teleport: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(pcVar4); - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0xffffffff; -LAB_080822c9: - // WARNING: Subroutine does not return - __cxa_throw(puVar3,&RESULT::typeinfo,0); -} - - - -void TeleportToCreature(TCreature *cr,char *Name) - -{ - bool bVar1; - ushort HouseID; - int Result; - int iVar2; - undefined4 *puVar3; - char *Text; - int iVar4; - int local_6c; - int x; - int y; - int z; - TPlayer *dest; - Object local_4c [4]; - Object local_3c [4]; - TPlayer *local_2c; - Object Obj; - - if (cr == (TCreature *)0x0) { - Text = &DAT_080fb360; - } - else if (cr->Type == PLAYER) { - // try { // try from 0808279f to 080829de has its CatchHandler @ 08082a36 - bVar1 = CheckRight(cr->ID,TELEPORT_TO_CHARACTER); - if (!bVar1) { - return; - } - if ((Name == (char *)0x0) || (*Name == '\0')) { - SendMessage(cr->Connection,0x17,"You must enter a name."); - return; - } - local_2c = (TPlayer *)0x0; - bVar1 = CheckRight(cr->ID,READ_GAMEMASTER_CHANNEL); - iVar2 = IdentifyPlayer(Name,false,!bVar1,(TPlayer **)&z); - if (iVar2 == -1) { - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0x1b; - goto LAB_080829a6; - } - if (iVar2 < 0) { - if (iVar2 == -2) { - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0x1c; - goto LAB_080829a6; - } - } - else if (iVar2 == 0) { - local_4c[0].ObjectID = (cr->CrObject).ObjectID; - local_3c[0].ObjectID = local_4c[0].ObjectID; - local_2c = (TPlayer *)local_4c[0].ObjectID; - if (cr == (TCreature *)z) { - GraphicalEffect(local_4c,0xb); - return; - } - GraphicalEffect(local_4c,3); - local_6c = *(int *)(z + 0x270); - x = *(int *)(z + 0x274); - y = *(int *)(z + 0x278); - HouseID = GetHouseID(local_6c,x,y); - bVar1 = SearchFreeField(&local_6c,&x,&y,1,HouseID,true); - if ((bVar1) || (iVar2 = x, iVar4 = y, bVar1 = IsProtectionZone(), !bVar1)) { - local_4c[0].ObjectID = NONE.ObjectID; - GetMapContainer((int)local_3c,local_6c,x); - dest = local_2c; - Move(0,(Object *)&dest,local_3c,-1,false,local_4c); - GraphicalEffect(); - Log("banish","%s teleportiert sich zu %s.\n",cr->Name,z + 0x214); - return; - } - puVar3 = (undefined4 *)__cxa_allocate_exception(4,iVar2,iVar4); - *puVar3 = 4; - goto LAB_080829a6; - } - Text = &DAT_080fb2a0; - } - else { - Text = "TeleportToCreature: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(Text); - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0xffffffff; -LAB_080829a6: - // WARNING: Subroutine does not return - __cxa_throw(puVar3,&RESULT::typeinfo,0); -} - - - -void TeleportPlayerToMe(TCreature *cr,char *Name) - -{ - bool bVar1; - ushort HouseID; - int Result; - int iVar2; - undefined4 *puVar3; - char *Text; - int local_6c; - int x; - int y; - int z; - TPlayer *dest; - Object local_4c [4]; - Object local_3c [4]; - TPlayer *local_2c; - Object Obj; - - if (cr == (TCreature *)0x0) { - Text = &DAT_080fb460; - } - else if (cr->Type == PLAYER) { - // try { // try from 08082a8f to 08082c5e has its CatchHandler @ 08082cb6 - bVar1 = CheckRight(cr->ID,RETRIEVE); - if (!bVar1) { - return; - } - if ((Name == (char *)0x0) || (*Name == '\0')) { - SendMessage(cr->Connection,0x17,"You must enter a name."); - return; - } - local_2c = (TPlayer *)0x0; - bVar1 = CheckRight(cr->ID,READ_GAMEMASTER_CHANNEL); - iVar2 = IdentifyPlayer(Name,false,!bVar1,(TPlayer **)&z); - if (iVar2 == -1) { - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0x1b; - goto LAB_08082c3b; - } - if (iVar2 < 0) { - if (iVar2 == -2) { - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0x1c; - goto LAB_08082c3b; - } - } - else if (iVar2 == 0) { - local_4c[0].ObjectID = *(undefined4 *)(z + 0x2d0); - local_3c[0].ObjectID = local_4c[0].ObjectID; - local_2c = (TPlayer *)local_4c[0].ObjectID; - GraphicalEffect(local_4c,3); - local_6c = cr->posx; - x = cr->posy; - y = cr->posz; - HouseID = GetHouseID(local_6c,x,y); - bVar1 = SearchFreeField(&local_6c,&x,&y,1,HouseID,false); - if (bVar1) { - local_4c[0].ObjectID = NONE.ObjectID; - GetMapContainer((int)local_3c,local_6c,x); - dest = local_2c; - Move(0,(Object *)&dest,local_3c,-1,false,local_4c); - GraphicalEffect(); - return; - } - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 4; - goto LAB_08082c3b; - } - Text = &DAT_080fb3a0; - } - else { - Text = "TeleportPlayerToMe: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(Text); - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0xffffffff; -LAB_08082c3b: - // WARNING: Subroutine does not return - __cxa_throw(puVar3,&RESULT::typeinfo,0); -} - - - // WARNING: Unknown calling convention -- yet parameter storage is locked void MagicRope(void) -- cgit v1.2.3