aboutsummaryrefslogtreecommitdiff
path: root/reference/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'reference/game.c')
-rw-r--r--reference/game.c3167
1 files changed, 0 insertions, 3167 deletions
diff --git a/reference/game.c b/reference/game.c
index 1df63aa..1a48631 100644
--- a/reference/game.c
+++ b/reference/game.c
@@ -4965,173 +4965,6 @@ bool ObjectTypeExists(uchar Group,uchar Number)
return (bool)((byte)~(byte)((uint)NewType[CONCAT11(Group,Number)] >> 0x18) >> 7);
}
-
-
-// DWARF original prototype: void setTypeID(ObjectType * this, int _TypeID)
-
-void __thiscall ObjectType::setTypeID(ObjectType *this,int _TypeID)
-
-{
- bool bVar1;
-
- bVar1 = false;
- if ((ObjectTypes.min <= _TypeID) && (_TypeID <= ObjectTypes.max)) {
- bVar1 = true;
- }
- if (!bVar1) {
- error(&DAT_080f0a80,_TypeID);
- _TypeID = 0;
- }
- this->TypeID = _TypeID;
- return;
-}
-
-
-
-// DWARF original prototype: char * getName(ObjectType * this, int Count)
-
-char * __thiscall ObjectType::getName(ObjectType *this)
-
-{
- char *pcVar1;
- TObjectType *pTVar2;
- int in_stack_00000008;
- char local_4c [4];
- char ObjectName [50];
-
- local_4c[0] = '\0';
- if (this->TypeID == 99) {
- error("ObjectType::getName: Der Kreaturtyp hat keinen Namen.\n");
- pcVar1 = (char *)0x0;
- }
- else {
- pTVar2 = vector<>::operator()(&ObjectTypes,this->TypeID);
- if (pTVar2->Name != (char *)0x0) {
- strcpy(local_4c,pTVar2->Name);
- }
- pcVar1 = Plural(local_4c,in_stack_00000008);
- }
- return pcVar1;
-}
-
-
-
-// DWARF original prototype: char * getDescription(ObjectType * this)
-
-char * __thiscall ObjectType::getDescription(ObjectType *this)
-
-{
- TObjectType *pTVar1;
-
- pTVar1 = vector<>::operator()(&ObjectTypes,this->TypeID);
- return pTVar1->Description;
-}
-
-
-
-// DWARF original prototype: bool getFlag(ObjectType * this, FLAG Flag)
-
-bool __thiscall ObjectType::getFlag(ObjectType *this,FLAG Flag)
-
-{
- uint uVar1;
- TObjectType *pTVar2;
- FLAG FVar3;
- uchar b;
-
- FVar3 = Flag + USEEVENT;
- if (-1 < (int)Flag) {
- FVar3 = Flag;
- }
- uVar1 = 1 << ((char)Flag + (char)((int)FVar3 >> 3) * -8 & 0x1fU);
- pTVar2 = vector<>::operator()(&ObjectTypes,this->TypeID);
- return (uint)(pTVar2->Flags[(int)FVar3 >> 3] & (byte)uVar1) == (uVar1 & 0xff);
-}
-
-
-
-// DWARF original prototype: ulong getAttribute(ObjectType * this, TYPEATTRIBUTE Attribute)
-
-ulong __thiscall ObjectType::getAttribute(ObjectType *this,TYPEATTRIBUTE Attribute)
-
-{
- FLAG FVar1;
- uint uVar2;
- TObjectType *pTVar3;
- ulong uVar4;
- FLAG FVar5;
- uchar b;
-
- FVar1 = TypeAttributeFlags[Attribute];
- FVar5 = FVar1 + USEEVENT;
- if (-1 < (int)FVar1) {
- FVar5 = FVar1;
- }
- uVar2 = 1 << ((char)FVar1 + (char)((int)FVar5 >> 3) * -8 & 0x1fU);
- pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID);
- if ((uint)(pTVar3->Flags[(int)FVar5 >> 3] & (byte)uVar2) == (uVar2 & 0xff)) {
- pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID);
- uVar4 = pTVar3->Attributes[Attribute];
- }
- else {
- error(&DAT_080f0c60,this->TypeID,TypeAttributeFlags[Attribute],Attribute);
- uVar4 = 0;
- }
- return uVar4;
-}
-
-
-
-// DWARF original prototype: int getAttributeOffset(ObjectType * this, INSTANCEATTRIBUTE Attribute)
-
-int __thiscall ObjectType::getAttributeOffset(ObjectType *this,INSTANCEATTRIBUTE Attribute)
-
-{
- FLAG FVar1;
- uint uVar2;
- TObjectType *pTVar3;
- int iVar4;
- FLAG FVar5;
- uchar b;
-
- FVar1 = InstanceAttributeFlags[Attribute];
- FVar5 = FVar1 + USEEVENT;
- if (-1 < (int)FVar1) {
- FVar5 = FVar1;
- }
- uVar2 = 1 << ((char)FVar1 + (char)((int)FVar5 >> 3) * -8 & 0x1fU);
- pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID);
- if ((uint)(pTVar3->Flags[(int)FVar5 >> 3] & (byte)uVar2) == (uVar2 & 0xff)) {
-LAB_08055e2a:
- pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID);
- iVar4 = pTVar3->AttributeOffsets[Attribute];
- }
- else {
- if (Attribute == CONTENT) {
- pTVar3 = vector<>::operator()(&ObjectTypes,this->TypeID);
- if ((pTVar3->Flags[0] & 0x20) != 0) goto LAB_08055e2a;
- }
- iVar4 = -1;
- }
- return iVar4;
-}
-
-
-
-bool ObjectTypeExists(int TypeID)
-
-{
- bool bVar1;
-
- bVar1 = false;
- if ((ObjectTypes.min <= TypeID) && (TypeID <= ObjectTypes.max)) {
- bVar1 = true;
- }
- return bVar1;
-}
-
-
-
ObjectType GetSpecialObject(SPECIALMEANING Meaning)
{
@@ -5359,334 +5192,6 @@ void __static_initialization_and_destruction_0(int __initialize_p,int __priority
return;
}
-
-
-TObject * AccessObject(Object *Obj)
-
-{
- TObject *pTVar1;
- ulong Position;
- uint uVar2;
-
- if (Obj->ObjectID == NONE.ObjectID) {
- error(&DAT_080f1200);
- pTVar1 = (TObject *)*HashTableData;
- }
- else {
- uVar2 = Obj->ObjectID & HashTableMask;
- if (HashTableType[uVar2] == '\x02') {
- UnswapSector(HashTableData[uVar2]);
- }
- if ((HashTableType[uVar2] != '\x01') ||
- (pTVar1 = (TObject *)HashTableData[uVar2], pTVar1->ObjectID != Obj->ObjectID)) {
- pTVar1 = (TObject *)*HashTableData;
- }
- }
- return pTVar1;
-}
-
-
-
-// DWARF original prototype: bool exists(Object * this)
-
-bool __thiscall Object::exists(Object *this)
-
-{
- bool bVar1;
- ulong Position;
- uint uVar2;
-
- bVar1 = false;
- if (this->ObjectID != 0) {
- uVar2 = this->ObjectID & HashTableMask;
- if (HashTableType[uVar2] == '\x02') {
- UnswapSector(HashTableData[uVar2]);
- }
- if ((HashTableType[uVar2] == '\x01') && (*(ulong *)HashTableData[uVar2] == this->ObjectID))
- {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- return bVar1;
-}
-
-
-
-// DWARF original prototype: ObjectType getObjectType(Object * this)
-
-ObjectType __thiscall Object::getObjectType(Object *this)
-
-{
- TObject *pTVar1;
- ulong *in_stack_00000008;
- Object local_1c [5];
-
- local_1c[0].ObjectID = *in_stack_00000008;
- pTVar1 = AccessObject(local_1c);
- ObjectType::setTypeID((ObjectType *)this,(pTVar1->Type).TypeID);
- return (ObjectType)(int)this;
-}
-
-
-
-// DWARF original prototype: ulong getAttribute(Object * this, INSTANCEATTRIBUTE Attribute)
-
-ulong __thiscall Object::getAttribute(Object *this,INSTANCEATTRIBUTE Attribute)
-
-{
- bool bVar1;
- TObject *pTVar2;
- int iVar3;
- int Offset;
- Object local_3c [4];
- Object local_2c [7];
-
- local_3c[0] = (Object)this->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID);
- iVar3 = ObjectType::getAttributeOffset((ObjectType *)local_2c,Attribute);
- if (iVar3 == -1) {
- local_2c[0] = (Object)this->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- error(&DAT_080f12a0,Attribute,local_3c[0].ObjectID);
- }
- else {
- bVar1 = false;
- if ((-1 < iVar3) && (iVar3 < 4)) {
- bVar1 = true;
- }
- if (bVar1) {
- local_3c[0] = (Object)this->ObjectID;
- pTVar2 = AccessObject(local_3c);
- return pTVar2->Attributes[iVar3];
- }
- local_2c[0] = (Object)this->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- error(&DAT_080f1240,iVar3,Attribute,local_3c[0].ObjectID);
- }
- return 0;
-}
-
-
-
-// DWARF original prototype: void setAttribute(Object * this, INSTANCEATTRIBUTE Attribute, ulong
-// Value)
-
-void __thiscall Object::setAttribute(Object *this,INSTANCEATTRIBUTE Attribute,ulong Value)
-
-{
- bool bVar1;
- TObject *pTVar2;
- int iVar3;
- int Offset;
- Object local_3c [4];
- Object local_2c [7];
-
- local_3c[0] = (Object)this->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID);
- iVar3 = ObjectType::getAttributeOffset((ObjectType *)local_2c,Attribute);
- if (iVar3 == -1) {
- local_2c[0] = (Object)this->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- error(&DAT_080f1360,Attribute,local_3c[0].ObjectID);
- }
- else {
- bVar1 = false;
- if ((-1 < iVar3) && (iVar3 < 4)) {
- bVar1 = true;
- }
- if (bVar1) {
- if (Value == 0) {
- if (((Attribute == AMOUNT) || (Attribute == POOLLIQUIDTYPE)) ||
- (Attribute == CHARGES)) {
- Value = 1;
- }
- if ((Value == 0) && (Attribute == REMAININGUSES)) {
- local_2c[0] = (Object)this->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- Value = ObjectType::getAttribute((ObjectType *)local_3c,TOTALUSES);
- }
- }
- local_3c[0] = (Object)this->ObjectID;
- pTVar2 = AccessObject(local_3c);
- pTVar2->Attributes[iVar3] = Value;
- }
- else {
- local_2c[0] = (Object)this->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- error(&DAT_080f1300,iVar3,Attribute,local_3c[0].ObjectID);
- }
- }
- return;
-}
-
-
-
-// DWARF original prototype: Object getNextObject(Object * this)
-
-Object __thiscall Object::getNextObject(Object *this)
-
-{
- TObject *pTVar1;
- ulong *in_stack_00000008;
- Object local_1c [5];
-
- local_1c[0].ObjectID = *in_stack_00000008;
- pTVar1 = AccessObject(local_1c);
- this->ObjectID = (pTVar1->NextObject).ObjectID;
- return (Object)(ulong)this;
-}
-
-
-
-// DWARF original prototype: Object getContainer(Object * this)
-
-Object __thiscall Object::getContainer(Object *this)
-
-{
- TObject *pTVar1;
- ulong *in_stack_00000008;
- Object local_1c [5];
-
- local_1c[0].ObjectID = *in_stack_00000008;
- pTVar1 = AccessObject(local_1c);
- this->ObjectID = (pTVar1->Container).ObjectID;
- return (Object)(ulong)this;
-}
-
-
-
-// DWARF original prototype: ulong getCreatureID(Object * this)
-
-ulong __thiscall Object::getCreatureID(Object *this)
-
-{
- TObject *pTVar1;
- ulong uVar2;
- Object local_3c [4];
- ObjectType local_2c [7];
-
- local_3c[0] = (Object)this->ObjectID;
- pTVar1 = AccessObject(local_3c);
- ObjectType::setTypeID(local_2c,(pTVar1->Type).TypeID);
- if (local_2c[0].TypeID == 99) {
- local_3c[0] = (Object)this->ObjectID;
- pTVar1 = AccessObject(local_3c);
- uVar2 = pTVar1->Attributes[1];
- }
- else {
- error("Object::getCreatureID: Objekt ist keine Kreatur.\n");
- uVar2 = 0;
- }
- return uVar2;
-}
-
-
-
-void GetObjectCoordinates(Object *Obj,int *x,int *y,int *z)
-
-{
- bool bVar1;
- TObject *pTVar2;
- ulong Position;
- uint uVar3;
- Object local_4c [4];
- Object local_3c [4];
- ObjectType local_2c [7];
-
- bVar1 = false;
- if (Obj->ObjectID != 0) {
- uVar3 = Obj->ObjectID & HashTableMask;
- if (HashTableType[uVar3] == '\x02') {
- UnswapSector(HashTableData[uVar3]);
- }
- if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (bVar1) {
- while( true ) {
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID(local_2c,(pTVar2->Type).TypeID);
- if (local_2c[0].TypeID == 0) break;
- local_4c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_4c);
- local_2c[0].TypeID = (pTVar2->Container).ObjectID;
- Obj->ObjectID = local_2c[0].TypeID;
- }
- local_4c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_4c);
- *x = pTVar2->Attributes[1];
- local_4c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_4c);
- *y = pTVar2->Attributes[2];
- local_4c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_4c);
- *z = (uint)(byte)pTVar2->Attributes[3];
- }
- else {
- error(&DAT_080f1400);
- *x = 0;
- *y = 0;
- *z = 0;
- }
- return;
-}
-
-
-
-uchar GetMapContainerFlags(Object *Obj)
-
-{
- bool bVar1;
- TObject *pTVar2;
- ulong Position;
- uint uVar3;
- Object local_3c [4];
- ObjectType local_2c [7];
-
- bVar1 = false;
- if (Obj->ObjectID != 0) {
- uVar3 = Obj->ObjectID & HashTableMask;
- if (HashTableType[uVar3] == '\x02') {
- UnswapSector(HashTableData[uVar3]);
- }
- if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (bVar1) {
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID(local_2c,(pTVar2->Type).TypeID);
- if (local_2c[0].TypeID == 0) {
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- return *(uchar *)((int)pTVar2->Attributes + 0xd);
- }
- }
- error("GetMapContainerFlags: Objekt ist kein MapContainer.\n");
- return '\0';
-}
-
-
-
void CronMove(int Destination,int Source)
{
@@ -6339,164 +5844,6 @@ void MoveObject(Object *Obj,Object *Con)
}
-
-void ChangeObject(Object *Obj,ObjectType *Type)
-
-{
- bool bVar1;
- TObject *pTVar2;
- ulong uVar3;
- ulong Position;
- uint uVar4;
- ulong *puVar5;
- ulong local_5c;
- ulong SavedExpireTime;
- int Delay;
- ulong local_50;
- ulong Amount;
- Object local_3c [4];
- Object local_2c [7];
-
- bVar1 = false;
- local_5c = 0;
- SavedExpireTime = 0xffffffff;
- local_50 = 0;
- if (Obj->ObjectID != 0) {
- uVar4 = Obj->ObjectID & HashTableMask;
- if (HashTableType[uVar4] == '\x02') {
- UnswapSector(HashTableData[uVar4]);
- }
- if ((HashTableType[uVar4] == '\x01') && (*(ulong *)HashTableData[uVar4] == Obj->ObjectID)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (bVar1) {
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID);
- ObjectType::setTypeID((ObjectType *)local_3c,0);
- if (local_2c[0].ObjectID != local_3c[0].ObjectID) {
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CUMULATIVE);
- if (bVar1) {
- local_50 = Object::getAttribute(Obj,AMOUNT);
- }
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,EXPIRE);
- if (bVar1) {
- local_3c[0] = (Object)Obj->ObjectID;
- local_5c = CronStop(local_3c);
- bVar1 = ObjectType::getFlag(Type,CUMULATIVE);
- if (bVar1) {
- local_50 = 1;
- }
- }
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,TEXT);
- if (bVar1) {
- bVar1 = ObjectType::getFlag(Type,TEXT);
- if (!bVar1) {
- uVar3 = Object::getAttribute(Obj,TEXTSTRING);
- DeleteDynamicString(uVar3);
- Object::setAttribute(Obj,TEXTSTRING,0);
- uVar3 = Object::getAttribute(Obj,EDITOR);
- DeleteDynamicString(uVar3);
- Object::setAttribute(Obj,EDITOR,0);
- }
- }
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,EXPIRESTOP);
- if (bVar1) {
- uVar3 = Object::getAttribute(Obj,SAVEDEXPIRETIME);
- if (uVar3 != 0) {
- SavedExpireTime = Object::getAttribute(Obj,SAVEDEXPIRETIME);
- }
- }
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,MAGICFIELD);
- if (bVar1) {
- Object::setAttribute(Obj,RESPONSIBLE,0);
- }
- }
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)&Amount,Type->TypeID);
- ObjectType::setTypeID(&pTVar2->Type,Amount);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)&Amount,CUMULATIVE);
- if (bVar1) {
- Delay = 1;
- puVar5 = (ulong *)&Delay;
- if (local_50 != 0) {
- puVar5 = &local_50;
- }
- Object::setAttribute(Obj,AMOUNT,*puVar5);
- }
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)&Amount,RUNE);
- if (bVar1) {
- uVar3 = Object::getAttribute(Obj,CHARGES);
- if (uVar3 == 0) {
- Object::setAttribute(Obj,CHARGES,1);
- }
- }
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)&Amount,LIQUIDPOOL);
- if (bVar1) {
- uVar3 = Object::getAttribute(Obj,POOLLIQUIDTYPE);
- if (uVar3 == 0) {
- Object::setAttribute(Obj,POOLLIQUIDTYPE,1);
- }
- }
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)&Amount,WEAROUT);
- if (bVar1) {
- uVar3 = Object::getAttribute(Obj,REMAININGUSES);
- if (uVar3 == 0) {
- uVar3 = ObjectType::getAttribute(Type,TOTALUSES);
- Object::setAttribute(Obj,REMAININGUSES,uVar3);
- }
- }
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)&Amount,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)&Amount,EXPIRESTOP);
- if (bVar1) {
- Object::setAttribute(Obj,SAVEDEXPIRETIME,local_5c);
- }
- Amount = Obj->ObjectID;
- CronExpire((Object *)&Amount,SavedExpireTime);
- }
- else {
- error(&DAT_080f19c0);
- }
- return;
-}
-
-
-
// WARNING: Variable defined which should be unmapped: Attribute_local
void ChangeObject(Object *Obj,INSTANCEATTRIBUTE Attribute,ulong Value)
@@ -6528,473 +5875,6 @@ void ChangeObject(Object *Obj,INSTANCEATTRIBUTE Attribute,ulong Value)
return;
}
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-TObject * GetFreeObjectSlot(void)
-
-{
- ulong *puVar1;
- TObject *Help;
- TObject *pTVar2;
-
- if (FirstFreeObject == (TObject *)0x0) {
- SwapSector();
- }
- pTVar2 = FirstFreeObject;
- if (FirstFreeObject == (TObject *)0x0) {
- error("GetFreeObjectSlot: Kein freier Platz mehr.\n");
- pTVar2 = (TObject *)0x0;
- }
- else {
- puVar1 = &FirstFreeObject->ObjectID;
- FirstFreeObject = (TObject *)(FirstFreeObject->NextObject).ObjectID;
- *puVar1 = 0;
- (pTVar2->NextObject).ObjectID = 0;
- (pTVar2->Container).ObjectID = 0;
- (pTVar2->Type).TypeID = 0;
- pTVar2->Attributes[0] = 0;
- pTVar2->Attributes[1] = 0;
- pTVar2->Attributes[2] = 0;
- pTVar2->Attributes[3] = 0;
- }
- return pTVar2;
-}
-
-
-
-// WARNING: Variable defined which should be unmapped: NewMask
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void ResizeHashTable(void)
-
-{
- uint *puVar1;
- size_t __size;
- ulong *puVar2;
- uchar *__s;
- uchar *__ptr;
- int iVar3;
- int i;
- int iVar4;
- ulong nr;
- size_t __size_00;
- uint uVar5;
- uchar *NewType;
- TObject *Entry;
- ulong *NewData;
- int NewMask;
-
- iVar4 = 1;
- __size = HashTableSize * 2;
- __size_00 = HashTableSize << 3;
- error(&DAT_080f1a40,__size);
- puVar2 = (ulong *)malloc(__size_00);
- __s = (uchar *)malloc(__size);
- memset(__s,0,__size);
- *__s = 0xff;
- iVar3 = HashTableSize;
- *puVar2 = *HashTableData;
- __ptr = HashTableType;
- if (1 < iVar3) {
- do {
- if (__ptr[iVar4] != '\0') {
- if (__ptr[iVar4] == '\x02') {
- UnswapSector(HashTableData[iVar4]);
- __ptr = HashTableType;
- }
- if (__ptr[iVar4] == '\x01') {
- puVar1 = (uint *)HashTableData[iVar4];
- uVar5 = __size - 1 & *puVar1;
- __s[uVar5] = '\x01';
- puVar2[uVar5] = (ulong)puVar1;
- iVar3 = HashTableSize;
- }
- else {
- error("ResizeHashTable: Fehler beim Reorganisieren der HashTabelle.\n");
- __ptr = HashTableType;
- iVar3 = HashTableSize;
- }
- }
- iVar4 = iVar4 + 1;
- } while (iVar4 < iVar3);
- }
- free(__ptr);
- free(HashTableData);
- iVar3 = HashTableSize;
- HashTableSize = __size;
- HashTableType = __s;
- HashTableFree = HashTableFree + iVar3;
- HashTableData = puVar2;
- HashTableMask = __size - 1;
- return;
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-Object CreateObject(void)
-
-{
- uchar uVar1;
- ulong *puVar2;
- ulong uVar3;
- TObject *Help;
- int iVar4;
- Object OVar5;
- TObject *pTVar6;
- ulong *in_stack_00000004;
-
- iVar4 = HashTableSize;
- if (0x7fffffff < (uint)HashTableSize) {
- iVar4 = HashTableSize + 0xf;
- }
- if (HashTableFree < iVar4 >> 4) {
- ResizeHashTable();
- }
- uVar1 = HashTableType[CreateObject::Iterator & HashTableMask];
- while (uVar1 != '\0') {
- CreateObject::Iterator = CreateObject::Iterator + 1;
- uVar1 = HashTableType[CreateObject::Iterator & HashTableMask];
- }
- if (FirstFreeObject == (TObject *)0x0) {
- SwapSector();
- }
- pTVar6 = FirstFreeObject;
- if (FirstFreeObject == (TObject *)0x0) {
- pTVar6 = (TObject *)0x0;
- error("GetFreeObjectSlot: Kein freier Platz mehr.\n");
- }
- else {
- puVar2 = &FirstFreeObject->ObjectID;
- FirstFreeObject = (TObject *)(FirstFreeObject->NextObject).ObjectID;
- *puVar2 = 0;
- (pTVar6->NextObject).ObjectID = 0;
- (pTVar6->Container).ObjectID = 0;
- (pTVar6->Type).TypeID = 0;
- pTVar6->Attributes[0] = 0;
- pTVar6->Attributes[1] = 0;
- pTVar6->Attributes[2] = 0;
- pTVar6->Attributes[3] = 0;
- }
- uVar3 = HashTableMask;
- iVar4 = CreateObject::Iterator;
- if (pTVar6 == (TObject *)0x0) {
- error("CreateObject: Kann Objekt nicht anlegen.\n");
- OVar5 = NONE;
- }
- else {
- pTVar6->ObjectID = CreateObject::Iterator;
- HashTableData[iVar4 & uVar3] = (ulong)pTVar6;
- HashTableType[iVar4 & HashTableMask] = '\x01';
- HashTableFree = HashTableFree + -1;
- IncrementObjectCounter();
- OVar5.ObjectID = CreateObject::Iterator;
- }
- *in_stack_00000004 = OVar5.ObjectID;
- return (Object)(ulong)in_stack_00000004;
-}
-
-
-
-int GetObjectPriority(Object *Obj)
-
-{
- bool bVar1;
- TObject *pTVar2;
- int iVar3;
- ulong Position;
- uint uVar4;
- Object local_3c [4];
- Object local_2c [7];
-
- bVar1 = false;
- if (Obj->ObjectID != 0) {
- uVar4 = Obj->ObjectID & HashTableMask;
- if (HashTableType[uVar4] == '\x02') {
- UnswapSector(HashTableData[uVar4]);
- }
- if ((HashTableType[uVar4] == '\x01') && (*(ulong *)HashTableData[uVar4] == Obj->ObjectID)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (bVar1) {
- local_3c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_2c,BANK);
- iVar3 = 0;
- if (!bVar1) {
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CLIP);
- iVar3 = 1;
- if (!bVar1) {
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,BOTTOM);
- iVar3 = 2;
- if (!bVar1) {
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,TOP);
- iVar3 = 3;
- if (!bVar1) {
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- iVar3 = (local_3c[0].ObjectID != 99) + 4;
- }
- }
- }
- }
- }
- else {
- error(&DAT_080f1b00);
- iVar3 = 0x7fffffff;
- }
- return iVar3;
-}
-
-
-
-void PlaceObject(Object *Obj,Object *Con,bool Append)
-
-{
- bool bVar1;
- TObject *pTVar2;
- int iVar3;
- int iVar4;
- int SearchPriority;
- Object *pAddr;
- uint uVar5;
- Object *pOVar6;
- int ObjPriority;
- char *pcVar7;
- int iStack_78;
- bool Append_local;
- int x;
- int y;
- int z;
- Object local_5c [4];
- Object local_4c [4];
- Object local_3c [4];
- ulong local_2c;
- Object Search;
-
- local_2c = 0;
- bVar1 = false;
- if (Obj->ObjectID != 0) {
- uVar5 = Obj->ObjectID & HashTableMask;
- if (HashTableType[uVar5] == '\x02') {
- UnswapSector(HashTableData[uVar5]);
- }
- if ((HashTableType[uVar5] == '\x01') && (*(ulong *)HashTableData[uVar5] == Obj->ObjectID)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (!bVar1) {
- pcVar7 = &DAT_080f1ca0;
-LAB_080595eb:
- error(pcVar7);
- return;
- }
- bVar1 = false;
- if (Con->ObjectID != 0) {
- uVar5 = Con->ObjectID & HashTableMask;
- if (HashTableType[uVar5] == '\x02') {
- UnswapSector(HashTableData[uVar5]);
- }
- if ((HashTableType[uVar5] == '\x01') && (*(ulong *)HashTableData[uVar5] == Con->ObjectID)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (!bVar1) {
- pcVar7 = &DAT_080f1b40;
- goto LAB_080595eb;
- }
- local_4c[0] = (Object)Con->ObjectID;
- pTVar2 = AccessObject(local_4c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CONTAINER);
- if (!bVar1) {
- local_3c[0] = (Object)Con->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_4c,CHEST);
- if (!bVar1) {
- local_3c[0] = (Object)Con->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID);
- error("PlaceObject: Con (%d) ist kein Container.\n",local_4c[0].ObjectID);
- return;
- }
- }
- local_3c[0] = (Object)Con->ObjectID;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)local_4c,(pTVar2->Type).TypeID);
- if (local_4c[0].ObjectID != 0) {
- z = Con->ObjectID;
- pTVar2 = AccessObject((Object *)&z);
- pOVar6 = (Object *)pTVar2->Attributes;
- local_2c = Object::getAttribute(Con,CONTENT);
- z = local_2c;
- if ((Append) && (z = NONE.ObjectID, local_2c != NONE.ObjectID)) {
- do {
- z = local_2c;
- local_5c[0].ObjectID = NONE.ObjectID;
- pTVar2 = AccessObject((Object *)&z);
- pOVar6 = &pTVar2->NextObject;
- local_4c[0].ObjectID = local_2c;
- pTVar2 = AccessObject(local_4c);
- local_2c = (pTVar2->NextObject).ObjectID;
- z = NONE.ObjectID;
- } while (local_2c != NONE.ObjectID);
- }
- goto LAB_08059780;
- }
- local_4c[0] = (Object)Obj->ObjectID;
- iVar3 = GetObjectPriority(local_4c);
- local_4c[0] = (Object)Con->ObjectID;
- pTVar2 = AccessObject(local_4c);
- pOVar6 = (Object *)pTVar2->Attributes;
- local_5c[0] = (Object)Con->ObjectID;
- z = NONE.ObjectID;
- if (local_5c[0].ObjectID == NONE.ObjectID) {
- error(&DAT_080f1b80);
-LAB_080596ed:
- local_3c[0].ObjectID = NONE.ObjectID;
- }
- else {
- Object::getObjectType((Object *)&z);
- bVar1 = ObjectType::getFlag((ObjectType *)&z,CONTAINER);
- if (!bVar1) {
- Object::getObjectType((Object *)&z);
- bVar1 = ObjectType::getFlag((ObjectType *)&z,CHEST);
- if (!bVar1) {
- Object::getObjectType((Object *)&z);
- error("GetFirstContainerObject: Con (%d) ist kein Container.\n",z);
- goto LAB_080596ed;
- }
- }
- local_3c[0].ObjectID = Object::getAttribute(local_5c,CONTENT);
- }
- z = NONE.ObjectID;
- local_2c = local_3c[0].ObjectID;
- local_4c[0].ObjectID = local_3c[0].ObjectID;
- if (local_3c[0].ObjectID != NONE.ObjectID) {
- do {
- z = local_2c;
- local_5c[0].ObjectID = NONE.ObjectID;
- iVar4 = GetObjectPriority((Object *)&z);
- if (iVar3 < iVar4) break;
- if ((Append) || (1 < iVar4 - 4U)) {
- if ((iVar4 == iVar3) && (((iVar3 == 0 || (iVar3 == 2)) || (iVar3 == 3)))) {
- z = Con->ObjectID;
- GetObjectCoordinates((Object *)&z,&stack0xffffff88,&x,&y);
- local_5c[0].ObjectID = local_2c;
- pTVar2 = AccessObject(local_5c);
- ObjectType::setTypeID((ObjectType *)&z,(pTVar2->Type).TypeID);
- iVar4 = z;
- local_4c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_4c);
- ObjectType::setTypeID((ObjectType *)local_5c,(pTVar2->Type).TypeID);
- if (iVar3 == 0) {
- pcVar7 = "BANK";
- }
- else {
- pcVar7 = "BOTTOM";
- if (iVar3 != 2) {
- pcVar7 = "TOP";
- }
- }
- error("PlaceObject: Zwei %s-Objekte (%d und %d) auf Feld [%d,%d,%d].\n",pcVar7,
- local_5c[0].ObjectID,iVar4,iStack_78,x,y);
- }
- }
- else if (iVar4 == iVar3) break;
- z = local_2c;
- pTVar2 = AccessObject((Object *)&z);
- pOVar6 = &pTVar2->NextObject;
- local_4c[0].ObjectID = local_2c;
- pTVar2 = AccessObject(local_4c);
- local_2c = (pTVar2->NextObject).ObjectID;
- z = NONE.ObjectID;
- } while (local_2c != NONE.ObjectID);
- }
-LAB_08059780:
- local_5c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_5c);
- local_4c[0].ObjectID = local_2c;
- (pTVar2->NextObject).ObjectID = local_2c;
- z = local_2c;
- local_5c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_5c);
- (pTVar2->Container).ObjectID = Con->ObjectID;
- pOVar6->ObjectID = Obj->ObjectID;
- return;
-}
-
-
-
-Object AppendObject(Object *Con,ObjectType *Type)
-
-{
- bool bVar1;
- ulong Position;
- uint uVar2;
- int *in_stack_0000000c;
- Object local_4c [4];
- Object local_3c [4];
- ulong local_2c;
- Object Obj;
-
- bVar1 = false;
- if (Type->TypeID != 0) {
- uVar2 = Type->TypeID & HashTableMask;
- if (HashTableType[uVar2] == '\x02') {
- UnswapSector(HashTableData[uVar2]);
- }
- if ((HashTableType[uVar2] == '\x01') && (*(int *)HashTableData[uVar2] == Type->TypeID)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (bVar1) {
- CreateObject();
- ObjectType::setTypeID((ObjectType *)local_3c,*in_stack_0000000c);
- local_4c[0].ObjectID = local_2c;
- ChangeObject(local_4c,(ObjectType *)local_3c);
- local_4c[0].ObjectID = Type->TypeID;
- local_3c[0].ObjectID = local_2c;
- PlaceObject(local_3c,local_4c,true);
- }
- else {
- error(&DAT_080f1ce0);
- local_2c = NONE.ObjectID;
- }
- Con->ObjectID = local_2c;
- return (Object)(ulong)Con;
-}
-
-
-
Object SetObject(Object *Con,ObjectType *Type,ulong CreatureID)
{
@@ -7169,23 +6049,6 @@ LAB_08059d74:
return (Object)(ulong)Con;
}
-
-
-void PutFreeObjectSlot(TObject *Entry)
-
-{
- if (Entry == (TObject *)0x0) {
- error("PutFreeObjectSlot: Entry ist NULL.\n");
- }
- else {
- (Entry->NextObject).ObjectID = (ulong)FirstFreeObject;
- FirstFreeObject = Entry;
- }
- return;
-}
-
-
-
void CutObject(Object *Obj)
{
@@ -7428,207 +6291,6 @@ void DeleteObject(Object *Obj)
return;
}
-
-
-Object GetMapContainer(int x,int y,int z)
-
-{
- int iVar1;
- bool bVar2;
- bool bVar3;
- matrix3d<TSector*> *pmVar4;
- int sx;
- int iVar5;
- Object OVar6;
- TSector **ppTVar7;
- int sy;
- int iVar8;
- int iVar9;
- int iVar10;
- int iVar11;
- int in_stack_00000010;
-
- pmVar4 = Sector;
- bVar3 = false;
- iVar9 = y + 0x1f;
- iVar11 = z + 0x1f;
- iVar10 = iVar9;
- if (-1 < y) {
- iVar10 = y;
- }
- iVar5 = iVar11;
- if (-1 < z) {
- iVar5 = z;
- }
- bVar2 = false;
- if ((SectorXMin <= iVar10 >> 5) && (bVar2 = true, SectorXMax < iVar10 >> 5)) {
- bVar2 = false;
- }
- if (bVar2) {
- bVar2 = false;
- if (SectorYMin <= iVar5 >> 5) {
- bVar2 = true;
- if (SectorYMax < iVar5 >> 5) {
- bVar2 = false;
- }
- }
- if (((bVar2) && (bVar3 = false, SectorZMin <= in_stack_00000010)) &&
- (bVar3 = true, SectorZMax < in_stack_00000010)) {
- bVar3 = false;
- }
- }
- if (bVar3) {
- iVar10 = iVar9;
- if (-1 < y) {
- iVar10 = y;
- }
- iVar5 = iVar11;
- if (-1 < z) {
- iVar5 = z;
- }
- iVar8 = (iVar5 >> 5) - Sector->ymin;
- iVar5 = in_stack_00000010 - Sector->zmin;
- iVar10 = (iVar10 >> 5) - Sector->xmin;
- if ((((iVar10 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar10)) ||
- ((iVar8 < 0 || ((Sector->dy <= iVar8 || (iVar5 < 0)))))) || (Sector->dz <= iVar5)) {
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar10 + Sector->xmin,
- iVar8 + Sector->ymin,iVar5 + Sector->zmin);
- ppTVar7 = pmVar4->entry;
- }
- else {
- ppTVar7 = Sector->entry + iVar10 + iVar8 * iVar1 + iVar5 * iVar1 * Sector->dy;
- }
- pmVar4 = Sector;
- OVar6.ObjectID = NONE.ObjectID;
- if (*ppTVar7 != (TSector *)0x0) {
- iVar10 = iVar9;
- if (-1 < y) {
- iVar10 = y;
- }
- iVar5 = iVar11;
- if (-1 < z) {
- iVar5 = z;
- }
- iVar8 = (iVar5 >> 5) - Sector->ymin;
- iVar5 = in_stack_00000010 - Sector->zmin;
- iVar10 = (iVar10 >> 5) - Sector->xmin;
- if (((((iVar10 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar10)) || (iVar8 < 0)) ||
- ((Sector->dy <= iVar8 || (iVar5 < 0)))) || (Sector->dz <= iVar5)) {
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar10 + Sector->xmin,
- iVar8 + Sector->ymin,iVar5 + Sector->zmin);
- ppTVar7 = pmVar4->entry;
- }
- else {
- ppTVar7 = Sector->entry + iVar10 + iVar8 * iVar1 + iVar5 * iVar1 * Sector->dy;
- }
- (*ppTVar7)->TimeStamp = RoundNr;
- pmVar4 = Sector;
- if (-1 < y) {
- iVar9 = y;
- }
- if (-1 < z) {
- iVar11 = z;
- }
- iVar8 = (iVar11 >> 5) - Sector->ymin;
- iVar10 = in_stack_00000010 - Sector->zmin;
- iVar5 = (iVar9 >> 5) - Sector->xmin;
- if (((iVar5 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar5)) ||
- ((iVar8 < 0 || (((Sector->dy <= iVar8 || (iVar10 < 0)) || (Sector->dz <= iVar10))))))
- {
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar5 + Sector->xmin,
- iVar8 + Sector->ymin,iVar10 + Sector->zmin);
- ppTVar7 = pmVar4->entry;
- }
- else {
- ppTVar7 = Sector->entry + iVar10 * iVar1 * Sector->dy + iVar8 * iVar1 + iVar5;
- }
- OVar6.ObjectID =
- *(ulong *)((z + (iVar11 >> 5) * -0x20 + (y + (iVar9 >> 5) * -0x20) * 0x20) * 4 +
- (int)*ppTVar7);
- }
- *(ulong *)x = OVar6.ObjectID;
- }
- else {
- *(ulong *)x = NONE.ObjectID;
- }
- return (Object)x;
-}
-
-
-
-Object GetMapContainer(Object *Obj)
-
-{
- bool bVar1;
- TObject *pTVar2;
- Object OVar3;
- ulong Position;
- uint uVar4;
- uint *in_stack_00000008;
- Object local_4c [4];
- Object local_3c [4];
- ObjectType local_2c [7];
-
- bVar1 = false;
- if (*in_stack_00000008 != 0) {
- uVar4 = *in_stack_00000008 & HashTableMask;
- if (HashTableType[uVar4] == '\x02') {
- UnswapSector(HashTableData[uVar4]);
- }
- if ((HashTableType[uVar4] == '\x01') &&
- (*(uint *)HashTableData[uVar4] == *in_stack_00000008)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (bVar1) {
- while( true ) {
- local_3c[0].ObjectID = *in_stack_00000008;
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID(local_2c,(pTVar2->Type).TypeID);
- if (local_2c[0].TypeID == 0) break;
- local_4c[0].ObjectID = *in_stack_00000008;
- pTVar2 = AccessObject(local_4c);
- local_2c[0].TypeID = (pTVar2->Container).ObjectID;
- *in_stack_00000008 = local_2c[0].TypeID;
- }
- OVar3.ObjectID = *in_stack_00000008;
- }
- else {
- error(&DAT_080f1fe0);
- OVar3 = NONE;
- }
- Obj->ObjectID = (ulong)OVar3;
- return (Object)(ulong)Obj;
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-Object GetFirstObject(void)
-
-{
- Object OVar1;
- ulong *in_stack_00000004;
- int in_stack_00000008;
- int in_stack_0000000c;
- Object local_1c;
- Object MapCon;
-
- GetMapContainer((int)&local_1c,in_stack_00000008,in_stack_0000000c);
- OVar1 = NONE;
- if (local_1c.ObjectID != NONE.ObjectID) {
- OVar1.ObjectID = Object::getAttribute(&local_1c,CONTENT);
- }
- *in_stack_00000004 = OVar1.ObjectID;
- return (Object)(ulong)in_stack_00000004;
-}
-
-
-
// WARNING: Unknown calling convention -- yet parameter storage is locked
Object GetFirstSpecObject(void)
@@ -7664,111 +6326,6 @@ Object GetFirstSpecObject(void)
return (Object)(ulong)in_stack_00000004;
}
-
-
-Object GetFirstContainerObject(Object *Con)
-
-{
- bool bVar1;
- TObject *pTVar2;
- Object OVar3;
- Object *in_stack_00000008;
- Object local_3c [4];
- Object local_2c [7];
-
- local_2c[0].ObjectID = NONE.ObjectID;
- local_3c[0].ObjectID = in_stack_00000008->ObjectID;
- if (local_3c[0].ObjectID == NONE.ObjectID) {
- error(&DAT_080f1b80);
- OVar3 = NONE;
- }
- else {
- pTVar2 = AccessObject(local_3c);
- ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER);
- if (!bVar1) {
- local_2c[0].ObjectID = in_stack_00000008->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_3c,CHEST);
- if (!bVar1) {
- local_2c[0].ObjectID = in_stack_00000008->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)local_3c,(pTVar2->Type).TypeID);
- error("GetFirstContainerObject: Con (%d) ist kein Container.\n",local_3c[0].ObjectID
- );
- OVar3 = NONE;
- goto LAB_0805abe7;
- }
- }
- OVar3.ObjectID = Object::getAttribute(in_stack_00000008,CONTENT);
- }
-LAB_0805abe7:
- Con->ObjectID = (ulong)OVar3;
- return (Object)(ulong)Con;
-}
-
-
-
-Object GetContainerObject(Object *Con,int nr)
-
-{
- bool bVar1;
- TObject *pTVar2;
- ulong Position;
- uint uVar3;
- int in_stack_0000000c;
- Object local_5c [4];
- ulong local_4c;
- ulong local_3c;
- Object local_2c;
- Object Obj;
-
- bVar1 = false;
- if (*(uint *)nr != 0) {
- uVar3 = *(uint *)nr & HashTableMask;
- if (HashTableType[uVar3] == '\x02') {
- UnswapSector(HashTableData[uVar3]);
- }
- if ((HashTableType[uVar3] == '\x01') && (*(int *)HashTableData[uVar3] == *(int *)nr)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (bVar1) {
- if (-1 < in_stack_0000000c) {
- local_3c = *(ulong *)nr;
- GetFirstContainerObject(&local_2c);
- if (local_2c.ObjectID != NONE.ObjectID) {
- do {
- if (in_stack_0000000c == 0) goto LAB_0805ad80;
- in_stack_0000000c = in_stack_0000000c + -1;
- local_5c[0].ObjectID = local_2c.ObjectID;
- local_4c = NONE.ObjectID;
- local_3c = NONE.ObjectID;
- pTVar2 = AccessObject(local_5c);
- local_2c.ObjectID = (pTVar2->NextObject).ObjectID;
- } while (local_2c.ObjectID != NONE.ObjectID);
- }
- Con->ObjectID = (ulong)NONE;
- return (Object)(ulong)Con;
- }
- error(&DAT_080f2020);
- local_2c = NONE;
- }
- else {
- error(&DAT_080f2060);
- local_2c = NONE;
- }
-LAB_0805ad80:
- Con->ObjectID = (ulong)local_2c;
- return (Object)(ulong)Con;
-}
-
-
-
bool IsOnMap(int x,int y,int z)
{
@@ -8224,472 +6781,6 @@ bool GetMarkPosition(void)
}
-
-void InitSector(int x,int y,int z)
-
-{
- int iVar1;
- matrix3d<TSector*> *pmVar2;
- int iVar3;
- TSector *pTVar4;
- TSector **ppTVar5;
- uint uVar6;
- TObject *pTVar7;
- int iVar8;
- int iVar9;
- TSector *pTVar10;
- int yy;
- TSector *Sec;
- int local_5c;
- int xx;
- Object local_3c [4];
- ulong local_2c;
- Object Obj;
-
- pmVar2 = Sector;
- iVar9 = y - Sector->ymin;
- iVar3 = z - Sector->zmin;
- iVar8 = x - Sector->xmin;
- if ((((iVar8 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar8)) || (iVar9 < 0)) ||
- (((Sector->dy <= iVar9 || (iVar3 < 0)) || (Sector->dz <= iVar3)))) {
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar8 + Sector->xmin,
- iVar9 + Sector->ymin,iVar3 + Sector->zmin);
- ppTVar5 = pmVar2->entry;
- }
- else {
- ppTVar5 = Sector->entry + iVar3 * iVar1 * Sector->dy + iVar9 * iVar1 + iVar8;
- }
- if (*ppTVar5 == (TSector *)0x0) {
- pTVar4 = (TSector *)malloc(0x1008);
- pmVar2 = Sector;
- iVar9 = y - Sector->ymin;
- iVar3 = z - Sector->zmin;
- iVar8 = x - Sector->xmin;
- if (((iVar8 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar8)) ||
- ((iVar9 < 0 || (((Sector->dy <= iVar9 || (iVar3 < 0)) || (Sector->dz <= iVar3)))))) {
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar8 + Sector->xmin,
- iVar9 + Sector->ymin,iVar3 + Sector->zmin);
- ppTVar5 = pmVar2->entry;
- }
- else {
- ppTVar5 = Sector->entry + iVar3 * iVar1 * Sector->dy + iVar9 * iVar1 + iVar8;
- }
- *ppTVar5 = pTVar4;
- uVar6 = 0x1008;
- pTVar10 = pTVar4;
- if (((uint)pTVar4 & 4) != 0) {
- pTVar4->MapCon[0][0].ObjectID = 0;
- uVar6 = 0x1004;
- pTVar10 = (TSector *)(pTVar4->MapCon[0] + 1);
- }
- for (uVar6 = uVar6 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) {
- pTVar10->MapCon[0][0].ObjectID = 0;
- pTVar10 = (TSector *)(pTVar10->MapCon[0] + 1);
- }
- pTVar4->Status = '\0';
- pTVar4->TimeStamp = RoundNr;
- local_5c = 0;
- do {
- iVar3 = 0;
- do {
- CreateObject();
- local_3c[0].ObjectID = local_2c;
- pTVar7 = AccessObject(local_3c);
- pTVar7->Attributes[1] = x * 0x20 + local_5c;
- local_3c[0].ObjectID = local_2c;
- pTVar7 = AccessObject(local_3c);
- pTVar7->Attributes[2] = y * 0x20 + iVar3;
- local_3c[0].ObjectID = local_2c;
- pTVar7 = AccessObject(local_3c);
- pTVar7->Attributes[3] = z;
- iVar8 = iVar3 + 1;
- pTVar4->MapCon[local_5c][iVar3].ObjectID = local_2c;
- iVar3 = iVar8;
- } while (iVar8 < 0x20);
- local_5c = local_5c + 1;
- } while (local_5c < 0x20);
- pTVar4->MapFlags = '\0';
- pTVar4->Status = '\x01';
- }
- else {
- error("InitSector: Sektor %d/%d/%d existiert schon.\n",x,y,z);
- }
- return;
-}
-
-
-
-void SwapObject(TWriteBinaryFile *File,Object *Obj,ulong FileNumber)
-
-{
- TObject *Entry_00;
- bool bVar1;
- TObject *pTVar2;
- ulong Position;
- uint uVar3;
- TObject *Entry;
- TObject *local_5c;
- TObject *local_4c;
- Object Help;
- Object local_3c;
- Object Search;
- Object local_2c [7];
-
- bVar1 = false;
- if (Obj->ObjectID != 0) {
- uVar3 = Obj->ObjectID & HashTableMask;
- if (HashTableType[uVar3] == '\x02') {
- UnswapSector(HashTableData[uVar3]);
- }
- if ((HashTableType[uVar3] == '\x01') && (*(ulong *)HashTableData[uVar3] == Obj->ObjectID)) {
- bVar1 = true;
- }
- else {
- bVar1 = false;
- }
- }
- if (!bVar1) {
- // try { // try from 0805b9bf to 0805bb3b has its CatchHandler @ 0805bb46
- error(&DAT_080f2300);
- return;
- }
- Entry_00 = (TObject *)HashTableData[HashTableMask & Obj->ObjectID];
- (*(File->super_TWriteStream)._vptr_TWriteStream[5])(File,Entry_00,0x20);
- local_3c = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(&local_3c);
- ObjectType::setTypeID((ObjectType *)local_2c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)local_2c,CONTAINER);
- if (!bVar1) {
- local_2c[0] = (Object)Obj->ObjectID;
- pTVar2 = AccessObject(local_2c);
- ObjectType::setTypeID((ObjectType *)&local_3c,(pTVar2->Type).TypeID);
- bVar1 = ObjectType::getFlag((ObjectType *)&local_3c,CHEST);
- if (!bVar1) goto LAB_0805bad8;
- }
- local_3c.ObjectID = Object::getAttribute(Obj,CONTENT);
- local_2c[0].ObjectID = NONE.ObjectID;
- local_4c = (TObject *)NONE.ObjectID;
- if (local_3c.ObjectID != NONE.ObjectID) {
- do {
- Entry = (TObject *)local_3c.ObjectID;
- local_4c = (TObject *)local_3c.ObjectID;
- local_2c[0].ObjectID = NONE.ObjectID;
- pTVar2 = AccessObject((Object *)&Entry);
- local_5c = (TObject *)(pTVar2->NextObject).ObjectID;
- Entry = local_4c;
- local_3c.ObjectID = (ulong)local_5c;
- local_2c[0].ObjectID = (ulong)local_5c;
- SwapObject(File,(Object *)&Entry,FileNumber);
- local_2c[0].ObjectID = NONE.ObjectID;
- local_4c = (TObject *)NONE.ObjectID;
- } while (local_3c.ObjectID != NONE.ObjectID);
- }
-LAB_0805bad8:
- PutFreeObjectSlot(Entry_00);
- HashTableType[HashTableMask & Obj->ObjectID] = '\x02';
- HashTableData[HashTableMask & Obj->ObjectID] = FileNumber;
- return;
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void SwapSector(void)
-
-{
- int iVar1;
- TSector *pTVar2;
- matrix3d<TSector*> *pmVar3;
- bool bVar4;
- TSector *Help;
- int iVar5;
- TSector **ppTVar6;
- int iVar7;
- int iVar8;
- int *piVar9;
- Object *Obj;
- char *__oflag;
- int local_206c;
- int local_2068;
- int yy;
- int xx;
- TSector *local_205c;
- int z;
- int y;
- int x;
- ulong Oldest;
- TSector *Sec;
- int SecZ;
- int SecY;
- int SecX;
- undefined1 local_202c [4];
- TWriteBinaryFile File;
- char local_101c [4];
- char FileName [4096];
-
- Oldest = 0;
- SecY = 0;
- SecZ = 0;
- x = RoundNr + 1;
- Sec = (TSector *)0x0;
- y = SectorXMin;
- iVar5 = SectorYMax;
- iVar7 = SectorXMax;
- if (SectorXMin <= SectorXMax) {
- do {
- z = SectorYMin;
- if (SectorYMin <= iVar5) {
- local_206c = SectorZMax;
- do {
- local_205c = (TSector *)SectorZMin;
- if (SectorZMin <= local_206c) {
- do {
- pmVar3 = Sector;
- iVar8 = z - Sector->ymin;
- iVar5 = (int)local_205c - Sector->zmin;
- iVar7 = y - Sector->xmin;
- if (((((iVar7 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar7)) ||
- (iVar8 < 0)) || ((Sector->dy <= iVar8 || (iVar5 < 0)))) ||
- (Sector->dz <= iVar5)) {
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",
- iVar7 + Sector->xmin,iVar8 + Sector->ymin,iVar5 + Sector->zmin
- );
- ppTVar6 = pmVar3->entry;
- local_206c = SectorZMax;
- }
- else {
- ppTVar6 = Sector->entry +
- iVar5 * iVar1 * Sector->dy + iVar8 * iVar1 + iVar7;
- }
- pTVar2 = *ppTVar6;
- if (((pTVar2 != (TSector *)0x0) && (pTVar2->Status == '\x01')) &&
- (pTVar2->TimeStamp < (uint)x)) {
- SecZ = z;
- SecY = y;
- Sec = local_205c;
- x = pTVar2->TimeStamp;
- Oldest = (ulong)pTVar2;
- }
- local_205c = (TSector *)((int)&local_205c->MapCon[0][0].ObjectID + 1);
- iVar5 = SectorYMax;
- } while ((int)local_205c <= local_206c);
- }
- z = z + 1;
- iVar7 = SectorXMax;
- } while (z <= iVar5);
- }
- y = y + 1;
- } while (y <= iVar7);
- }
- if (Oldest == 0) {
- error("FATAL ERROR in SwapSector: Es kann kein Sektor ausgelagert werden.\n");
- // WARNING: Subroutine does not return
- abort();
- }
- do {
- SwapSector::lexical_block_2::FileNumber = SwapSector::lexical_block_2::FileNumber + 1;
- if (99999999 < SwapSector::lexical_block_2::FileNumber) {
- SwapSector::lexical_block_2::FileNumber = 1;
- }
- __oflag = SAVEPATH;
- sprintf(local_101c,"%s/%08ld.swp",SAVEPATH,SwapSector::lexical_block_2::FileNumber);
- bVar4 = FileExists(local_101c);
- } while (bVar4);
- TWriteBinaryFile::TWriteBinaryFile((TWriteBinaryFile *)local_202c);
- // try { // try from 0805bd5f to 0805be46 has its CatchHandler @ 0805bee3
- TWriteBinaryFile::open((TWriteBinaryFile *)local_202c,local_101c,(int)__oflag);
- print();
- TWriteStream::writeQuad((TWriteStream *)local_202c,SecY);
- TWriteStream::writeQuad((TWriteStream *)local_202c,SecZ);
- TWriteStream::writeQuad((TWriteStream *)local_202c,(ulong)Sec);
- yy = 0;
- do {
- local_2068 = 0;
- piVar9 = (int *)(Oldest + yy * 0x80);
- do {
- SecX = *piVar9;
- Obj = (Object *)&SecX;
- SwapObject((TWriteBinaryFile *)local_202c,Obj,SwapSector::lexical_block_2::FileNumber);
- local_2068 = local_2068 + 1;
- piVar9 = piVar9 + 1;
- } while (local_2068 < 0x20);
- yy = yy + 1;
- } while (yy < 0x20);
- *(undefined1 *)(Oldest + 0x1004) = 2;
- TWriteBinaryFile::close((TWriteBinaryFile *)local_202c,(int)Obj);
- TWriteBinaryFile::~TWriteBinaryFile((TWriteBinaryFile *)local_202c,(int)Obj);
- return;
-}
-
-
-
-void UnswapSector(ulong FileNumber)
-
-{
- int iVar1;
- TSector *pTVar2;
- ulong *puVar3;
- matrix3d<TSector*> *pmVar4;
- uchar *puVar5;
- int iVar6;
- TObject *pTVar7;
- ulong uVar8;
- ulong uVar9;
- int iVar10;
- TSector **ppTVar11;
- int iVar12;
- ulong nr;
- int iVar13;
- uint uVar14;
- TSector *Sec;
- char *pcVar15;
- ulong uVar16;
- TObject *local_204c;
- int SecZ;
- int SecY;
- int SecX;
- int FileSize;
- TReadBinaryFile File;
- char local_101c [4];
- char FileName [4096];
-
- pcVar15 = SAVEPATH;
- sprintf(local_101c,"%s/%08ld.swp",SAVEPATH,FileNumber);
- TReadBinaryFile::TReadBinaryFile((TReadBinaryFile *)&FileSize);
- // try { // try from 0805bf7c to 0805c0c2 has its CatchHandler @ 0805c257
- TReadBinaryFile::open((TReadBinaryFile *)&FileSize,local_101c,(int)pcVar15);
- iVar6 = TReadBinaryFile::getSize((TReadBinaryFile *)&FileSize);
- pTVar7 = (TObject *)TReadStream::readQuad((TReadStream *)&FileSize);
- uVar8 = TReadStream::readQuad((TReadStream *)&FileSize);
- uVar9 = TReadStream::readQuad((TReadStream *)&FileSize);
- pcVar15 = "Lagere Sector %d/%d/%d ein...\n";
- uVar16 = uVar9;
- print();
- pmVar4 = Sector;
- iVar13 = uVar8 - Sector->ymin;
- iVar10 = uVar9 - Sector->zmin;
- iVar12 = (int)pTVar7 - Sector->xmin;
- if ((((iVar12 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar12)) || (iVar13 < 0)) ||
- (((Sector->dy <= iVar13 || (iVar10 < 0)) || (Sector->dz <= iVar10)))) {
- pcVar15 = (char *)(iVar12 + Sector->xmin);
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",pcVar15,iVar13 + Sector->ymin,
- iVar10 + Sector->zmin,uVar16);
- ppTVar11 = pmVar4->entry;
- }
- else {
- ppTVar11 = Sector->entry + iVar12 + iVar13 * iVar1 + iVar10 * iVar1 * Sector->dy;
- }
- pTVar2 = *ppTVar11;
- if (pTVar2 == (TSector *)0x0) {
- pcVar15 = "UnswapSector: Sektor %d/%d/%d existiert nicht.\n";
- }
- else {
- if (pTVar2->Status == '\x02') {
- while( true ) {
- // try { // try from 0805c0db to 0805c1ee has its CatchHandler @ 0805c257
- iVar10 = TReadBinaryFile::getPosition((TReadBinaryFile *)&FileSize);
- if (iVar6 <= iVar10) break;
- if (FirstFreeObject == (TObject *)0x0) {
- SwapSector();
- }
- local_204c = FirstFreeObject;
- if (FirstFreeObject == (TObject *)0x0) {
- error("GetFreeObjectSlot: Kein freier Platz mehr.\n");
- local_204c = (TObject *)0x0;
- }
- else {
- puVar3 = &FirstFreeObject->ObjectID;
- FirstFreeObject = (TObject *)(FirstFreeObject->NextObject).ObjectID;
- *puVar3 = 0;
- (local_204c->NextObject).ObjectID = 0;
- (local_204c->Container).ObjectID = 0;
- (local_204c->Type).TypeID = 0;
- local_204c->Attributes[0] = 0;
- local_204c->Attributes[1] = 0;
- local_204c->Attributes[2] = 0;
- local_204c->Attributes[3] = 0;
- }
- pTVar7 = local_204c;
- TReadBinaryFile::readBytes((TReadBinaryFile *)&FileSize,(uchar *)local_204c,0x20);
- puVar5 = HashTableType;
- pcVar15 = (char *)local_204c->ObjectID;
- uVar14 = (uint)pcVar15 & HashTableMask;
- if (HashTableType[uVar14] == '\x02') {
- HashTableData[uVar14] = (ulong)local_204c;
- puVar5[uVar14] = '\x01';
- pcVar15 = (char *)pTVar7;
- }
- else {
- error("UnswapSector: Objekt %ld existiert schon.\n");
- }
- }
- pTVar2->Status = '\x01';
- TReadBinaryFile::close((TReadBinaryFile *)&FileSize,(int)pcVar15);
- unlink(local_101c);
- goto LAB_0805c0c3;
- }
- pcVar15 = "UnswapSector: Sektor %d/%d/%d ist nicht ausgelagert.\n";
- }
- error(pcVar15,pTVar7,uVar8,uVar9,uVar16);
- TReadBinaryFile::close((TReadBinaryFile *)&FileSize,(int)pTVar7);
- pcVar15 = (char *)pTVar7;
-LAB_0805c0c3:
- TReadBinaryFile::~TReadBinaryFile((TReadBinaryFile *)&FileSize,(int)pcVar15);
- return;
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void DeleteSwappedSectors(void)
-
-{
- DIR *__dirp;
- dirent *pdVar1;
- size_t sVar2;
- int iVar3;
- dirent *DirEntry;
- char *pcVar4;
- char *pcVar5;
- bool bVar6;
- char *s;
- DIR *WorkDir;
- char FileName [4096];
-
- __dirp = opendir(SAVEPATH);
- if (__dirp == (DIR *)0x0) {
- error("DeleteSwappedSectors: Unterverzeichnis %s nicht gefunden\n",SAVEPATH);
- }
- else {
- while (pdVar1 = readdir(__dirp), pdVar1 != (dirent *)0x0) {
- sVar2 = strlen(pdVar1->d_name);
- bVar6 = sVar2 == 0xc;
- if (bVar6) {
- iVar3 = 4;
- pcVar4 = pdVar1->d_name + 8;
- pcVar5 = ".swp";
- do {
- if (iVar3 == 0) break;
- iVar3 = iVar3 + -1;
- bVar6 = *pcVar4 == *pcVar5;
- pcVar4 = pcVar4 + 1;
- pcVar5 = pcVar5 + 1;
- } while (bVar6);
- if (bVar6) {
- sprintf((char *)&WorkDir,"%s/%s",SAVEPATH,pdVar1->d_name);
- unlink((char *)&WorkDir);
- }
- }
- }
- closedir(__dirp);
- }
- return;
-}
-
-
-
int GetInstanceAttributeByName(char *Name)
{
@@ -8711,504 +6802,6 @@ int GetInstanceAttributeByName(char *Name)
return -1;
}
-
-
-// WARNING: Variable defined which should be unmapped: Skip_local
-
-void LoadObjects(TReadScriptFile *Script,TWriteStream *Stream,bool Skip)
-
-{
- bool bVar1;
- char cVar2;
- uint uVar3;
- undefined4 *puVar4;
- char *pcVar5;
- int iVar6;
- ushort TypeID;
- char (*s1) [30];
- uint local_24;
- int i;
- int iStack_18;
- bool ProcessObjects;
- int Depth;
- bool Skip_local;
-
- iStack_18 = 1;
- // try { // try from 0805c41e to 0805c65e has its CatchHandler @ 0805c661
- TReadScriptFile::readSymbol(Script,'{');
- bVar1 = true;
- TReadScriptFile::nextToken(Script);
- do {
- if (bVar1) {
- if (Script->Token == SPECIAL) {
- cVar2 = TReadScriptFile::getSpecial(Script);
- if (cVar2 == '}') {
- if (!Skip) {
- (*Stream->_vptr_TWriteStream[2])(Stream,0xffff);
- }
- iStack_18 = iStack_18 + -1;
- bVar1 = false;
- if (iStack_18 < 1) {
- return;
- }
- goto LAB_0805c45f;
- }
- if ((Script->Token == SPECIAL) &&
- (cVar2 = TReadScriptFile::getSpecial(Script), cVar2 == ',')) {
- TReadScriptFile::nextToken(Script);
- }
- }
- uVar3 = TReadScriptFile::getNumber(Script);
- bVar1 = ObjectTypeExists(uVar3 & 0xffff);
- if (!bVar1) {
- puVar4 = (undefined4 *)__cxa_allocate_exception(4);
- *puVar4 = "unknown object type";
-LAB_0805c49b:
- // WARNING: Subroutine does not return
- __cxa_throw(puVar4,char_const*::typeinfo,0);
- }
- if (!Skip) {
- (*Stream->_vptr_TWriteStream[2])(Stream,uVar3 & 0xffff);
- }
- bVar1 = false;
-LAB_0805c45f:
- TReadScriptFile::nextToken(Script);
- }
- else {
- if (Script->Token != SPECIAL) {
- pcVar5 = TReadScriptFile::getIdentifier(Script);
- s1 = InstanceAttributeNames;
- local_24 = 0;
- do {
- iVar6 = stricmp(*s1,pcVar5,-1);
- if (iVar6 == 0) goto LAB_0805c564;
- local_24 = local_24 + 1;
- s1 = s1 + 1;
- } while ((int)local_24 < 0x12);
- local_24 = 0xffffffff;
-LAB_0805c564:
- if (local_24 == 0xffffffff) {
- puVar4 = (undefined4 *)__cxa_allocate_exception(4);
- *puVar4 = "unknown attribute";
- goto LAB_0805c49b;
- }
- TReadScriptFile::readSymbol(Script,'=');
- if (!Skip) {
- (*Stream->_vptr_TWriteStream[1])(Stream,local_24 & 0xff);
- }
- if (local_24 == 0) {
- iStack_18 = iStack_18 + 1;
- TReadScriptFile::readSymbol(Script,'{');
- bVar1 = true;
- }
- else if (local_24 - 9 < 2) {
- if (Skip) {
- TReadScriptFile::readString(Script);
- }
- else {
- pcVar5 = TReadScriptFile::readString(Script);
- (*Stream->_vptr_TWriteStream[4])(Stream,pcVar5);
- }
- }
- else if (Skip) {
- TReadScriptFile::readNumber(Script);
- }
- else {
- iVar6 = TReadScriptFile::readNumber(Script);
- (*Stream->_vptr_TWriteStream[3])(Stream,iVar6);
- }
- goto LAB_0805c45f;
- }
- if (!Skip) {
- (*Stream->_vptr_TWriteStream[1])(Stream,0xff);
- }
- bVar1 = true;
- }
- if (iStack_18 < 1) {
- return;
- }
- } while( true );
-}
-
-
-
-void LoadObjects(TReadStream *Stream,Object *Con)
-
-{
- bool bVar1;
- char cVar2;
- ulong Value;
- uint uVar3;
- TObject *pTVar4;
- INSTANCEATTRIBUTE IVar5;
- ulong Value_00;
- int NewDelay;
- ulong Value_1;
- ushort TypeID;
- int Depth;
- int iVar6;
- char local_108c [3];
- bool ProcessObjects;
- char Help [4096];
- ObjectType local_7c [4];
- ulong local_6c [4];
- Object local_5c;
- ObjectType Type;
- Object local_3c [4];
- Object local_2c;
- Object Obj;
-
- iVar6 = 1;
- bVar1 = true;
- local_2c.ObjectID = NONE.ObjectID;
- do {
- if (bVar1) {
- // try { // try from 0805c6bb to 0805c867 has its CatchHandler @ 0805c870
- uVar3 = (*Stream->_vptr_TReadStream[2])(Stream);
- if ((short)uVar3 == -1) {
- iVar6 = iVar6 + -1;
- local_5c = (Object)Con->ObjectID;
- local_3c[0].ObjectID = local_5c.ObjectID;
- local_2c.ObjectID = local_5c.ObjectID;
- pTVar4 = AccessObject(&local_5c);
- local_3c[0].ObjectID = (pTVar4->Container).ObjectID;
- Con->ObjectID = (ulong)local_3c[0];
- }
- else {
- ObjectCounter = ObjectCounter + 1;
- ObjectType::setTypeID((ObjectType *)&local_5c,uVar3 & 0xffff);
- bVar1 = false;
- if ((0 < (int)local_5c.ObjectID) && ((int)local_5c.ObjectID < 0xb)) {
- bVar1 = true;
- }
- if (bVar1) {
- local_6c[0] = Con->ObjectID;
- GetContainerObject(local_3c,(int)local_6c);
- }
- else {
- ObjectType::setTypeID(local_7c,local_5c.ObjectID);
- Help._4092_4_ = Con->ObjectID;
- AppendObject(local_3c,(ObjectType *)(Help + 0xffc));
- }
- local_2c.ObjectID = local_3c[0].ObjectID;
- }
- bVar1 = false;
- }
- else {
- IVar5 = (*Stream->_vptr_TReadStream[1])(Stream);
- cVar2 = (char)IVar5;
- if (cVar2 != -1) {
- if (cVar2 != '\0') {
- if ((byte)(cVar2 - 9U) < 2) {
- (*Stream->_vptr_TReadStream[4])(Stream,local_108c,0x1000);
- Value_00 = AddDynamicString(local_108c);
- }
- else {
- if (cVar2 == '\x0f') {
- NewDelay = (*Stream->_vptr_TReadStream[3])(Stream);
- if (NewDelay != 0) {
- Help[0xffc] = (undefined1)local_2c.ObjectID;
- Help[0xffd] = local_2c.ObjectID._1_1_;
- Help[0xffe] = local_2c.ObjectID._2_1_;
- Help[0xfff] = local_2c.ObjectID._3_1_;
- CronChange((Object *)(Help + 0xffc),NewDelay);
- }
- goto LAB_0805c72d;
- }
- Value_00 = (*Stream->_vptr_TReadStream[3])(Stream);
- }
- Object::setAttribute(&local_2c,IVar5 & 0xff,Value_00);
- goto LAB_0805c72d;
- }
- iVar6 = iVar6 + 1;
- local_7c[0].TypeID = local_2c.ObjectID;
- Con->ObjectID = (ulong)local_2c;
- Help[0xffc] = (undefined1)local_2c.ObjectID;
- Help[0xffd] = local_2c.ObjectID._1_1_;
- Help[0xffe] = local_2c.ObjectID._2_1_;
- Help[0xfff] = local_2c.ObjectID._3_1_;
- }
- bVar1 = true;
- }
-LAB_0805c72d:
- if (iVar6 < 1) {
- return;
- }
- } while( true );
-}
-
-
-
-void LoadSector(char *FileName,int x,int y,int z)
-
-{
- int iVar1;
- TSector *pTVar2;
- bool bVar3;
- matrix3d<TSector*> *pmVar4;
- char cVar5;
- uchar *Help;
- int iVar6;
- TSector **ppTVar7;
- char *pcVar8;
- TObject *pTVar9;
- byte *pbVar10;
- int iVar11;
- int iVar12;
- int iVar13;
- char *pcVar14;
- undefined1 uVar15;
- char *pcVar16;
- uint local_4034;
- int yy;
- int xx;
- TSector *Sec;
- undefined1 local_400c [4];
- TReadBuffer ReadBuffer;
- TReadScriptFile Script;
-
- bVar3 = false;
- if ((SectorXMin <= x) && (x <= SectorXMax)) {
- bVar3 = true;
- }
- if (bVar3) {
- bVar3 = false;
- if ((SectorYMin <= y) && (y <= SectorYMax)) {
- bVar3 = true;
- }
- if (bVar3) {
- bVar3 = false;
- if ((SectorZMin <= z) && (z <= SectorZMax)) {
- bVar3 = true;
- }
- if (bVar3) {
- iVar12 = z;
- // try { // try from 0805c920 to 0805c932 has its CatchHandler @ 0805cde4
- InitSector(x,y,z);
- TReadScriptFile::TReadScriptFile((TReadScriptFile *)&ReadBuffer.Position);
- // try { // try from 0805c943 to 0805cd14 has its CatchHandler @ 0805cd60
- TReadScriptFile::open((TReadScriptFile *)&ReadBuffer.Position,FileName,iVar12);
- pcVar16 = "Lade Sektor %d/%d/%d ...\n";
- iVar12 = z;
- print();
- pmVar4 = Sector;
- iVar13 = y - Sector->ymin;
- iVar6 = z - Sector->zmin;
- iVar11 = x - Sector->xmin;
- if (((((iVar11 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar11)) || (iVar13 < 0)) ||
- ((Sector->dy <= iVar13 || (iVar6 < 0)))) || (Sector->dz <= iVar6)) {
- pcVar16 = (char *)(iVar11 + Sector->xmin);
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",pcVar16,
- iVar13 + Sector->ymin,iVar6 + Sector->zmin,iVar12);
- ppTVar7 = pmVar4->entry;
- }
- else {
- ppTVar7 = Sector->entry + iVar6 * iVar1 * Sector->dy + iVar13 * iVar1 + iVar11;
- }
- pTVar2 = *ppTVar7;
- yy = -1;
- local_4034 = 0xffffffff;
-LAB_0805ca1d:
- do {
- while( true ) {
- while( true ) {
- do {
- TReadScriptFile::nextToken((TReadScriptFile *)&ReadBuffer.Position);
- if (ReadBuffer.Position == 0) {
- TReadScriptFile::close
- ((TReadScriptFile *)&ReadBuffer.Position,(int)pcVar16)
- ;
- // try { // try from 0805cd1e to 0805cd22 has its CatchHandler @ 0805cde4
- TReadScriptFile::~TReadScriptFile
- ((TReadScriptFile *)&ReadBuffer.Position,(int)pcVar16)
- ;
- return;
- }
- } while ((ReadBuffer.Position == 6) &&
- (cVar5 = TReadScriptFile::getSpecial
- ((TReadScriptFile *)&ReadBuffer.Position),
- cVar5 == ','));
- if (ReadBuffer.Position != 4) break;
- pbVar10 = TReadScriptFile::getBytesequence
- ((TReadScriptFile *)&ReadBuffer.Position);
- yy = (int)*pbVar10;
- local_4034 = (uint)pbVar10[1];
- pcVar16 = (char *)0x3a;
- TReadScriptFile::readSymbol((TReadScriptFile *)&ReadBuffer.Position,':')
- ;
- }
- if (ReadBuffer.Position == 1) break;
- pcVar16 = "next map point expected";
-LAB_0805ca73:
- TReadScriptFile::error((TReadScriptFile *)&ReadBuffer.Position,pcVar16);
- }
- uVar15 = yy == -1;
- if ((bool)uVar15) {
- pcVar16 = "coordinate expected";
- TReadScriptFile::error
- ((TReadScriptFile *)&ReadBuffer.Position,"coordinate expected");
- }
- pcVar8 = TReadScriptFile::getIdentifier((TReadScriptFile *)&ReadBuffer.Position)
- ;
- iVar12 = 8;
- pcVar14 = "refresh";
- do {
- if (iVar12 == 0) break;
- iVar12 = iVar12 + -1;
- uVar15 = *pcVar8 == *pcVar14;
- pcVar8 = pcVar8 + 1;
- pcVar14 = pcVar14 + 1;
- } while ((bool)uVar15);
- if (!(bool)uVar15) {
- pcVar8 = TReadScriptFile::getIdentifier
- ((TReadScriptFile *)&ReadBuffer.Position);
- iVar12 = 9;
- pcVar14 = "nologout";
- do {
- if (iVar12 == 0) break;
- iVar12 = iVar12 + -1;
- uVar15 = *pcVar8 == *pcVar14;
- pcVar8 = pcVar8 + 1;
- pcVar14 = pcVar14 + 1;
- } while ((bool)uVar15);
- if ((bool)uVar15) {
- pTVar2->MapFlags = pTVar2->MapFlags | 2;
- local_400c = (undefined1 [4])pTVar2->MapCon[yy][local_4034].ObjectID;
- pTVar9 = AccessObject((Object *)local_400c);
- pTVar9->Attributes[3] = pTVar9->Attributes[3] | 0x200;
- }
- else {
- pcVar8 = TReadScriptFile::getIdentifier
- ((TReadScriptFile *)&ReadBuffer.Position);
- iVar12 = 0xf;
- pcVar14 = "protectionzone";
- do {
- if (iVar12 == 0) break;
- iVar12 = iVar12 + -1;
- uVar15 = *pcVar8 == *pcVar14;
- pcVar8 = pcVar8 + 1;
- pcVar14 = pcVar14 + 1;
- } while ((bool)uVar15);
- if ((bool)uVar15) {
- pTVar2->MapFlags = pTVar2->MapFlags | 4;
- local_400c = (undefined1 [4])
- pTVar2->MapCon[yy][local_4034].ObjectID;
- pTVar9 = AccessObject((Object *)local_400c);
- pTVar9->Attributes[3] = pTVar9->Attributes[3] | 0x400;
- }
- else {
- pcVar16 = TReadScriptFile::getIdentifier
- ((TReadScriptFile *)&ReadBuffer.Position);
- iVar12 = 8;
- pcVar8 = "content";
- do {
- if (iVar12 == 0) break;
- iVar12 = iVar12 + -1;
- uVar15 = *pcVar16 == *pcVar8;
- pcVar16 = pcVar16 + 1;
- pcVar8 = pcVar8 + 1;
- } while ((bool)uVar15);
- if (!(bool)uVar15) {
- pcVar16 = "unknown map flag";
- goto LAB_0805ca73;
- }
- TReadScriptFile::readSymbol
- ((TReadScriptFile *)&ReadBuffer.Position,'=');
- HelpBuffer.super_TWriteBuffer.Position = 0;
- LoadObjects((TReadScriptFile *)&ReadBuffer.Position,
- (TWriteStream *)&HelpBuffer,false);
- TReadBuffer::TReadBuffer
- ((TReadBuffer *)local_400c,
- HelpBuffer.super_TWriteBuffer.Data,
- HelpBuffer.super_TWriteBuffer.Position);
- GetMapContainer((int)&Sec,x * 0x20 + yy,y * 0x20 + local_4034);
- pcVar16 = (char *)&Sec;
- LoadObjects((TReadStream *)local_400c,(Object *)pcVar16);
- }
- }
- goto LAB_0805ca1d;
- }
- pTVar2->MapFlags = pTVar2->MapFlags | 1;
- local_400c = (undefined1 [4])pTVar2->MapCon[yy][local_4034].ObjectID;
- pTVar9 = AccessObject((Object *)local_400c);
- pTVar9->Attributes[3] = pTVar9->Attributes[3] | 0x100;
- } while( true );
- }
- }
- }
- return;
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void LoadMap(void)
-
-{
- char *__s;
- DIR *__dirp;
- dirent *pdVar1;
- size_t sVar2;
- undefined4 *puVar3;
- int iVar4;
- dirent *DirEntry;
- char *pcVar5;
- char *pcVar6;
- bool bVar7;
- DIR *WorkDir;
- int SectorCounter;
- int x;
- int y;
- int z;
- char FileName [4096];
-
- __dirp = opendir(MAPPATH);
- if (__dirp == (DIR *)0x0) {
- error("LoadMap: Unterverzeichnis %s nicht gefunden\n",MAPPATH);
- puVar3 = (undefined4 *)__cxa_allocate_exception(4);
- *puVar3 = "Cannot load map";
- // WARNING: Subroutine does not return
- __cxa_throw(puVar3,char_const*::typeinfo,0);
- }
- // try { // try from 0805ce35 to 0805cfb2 has its CatchHandler @ 0805cfb3
- print();
- ObjectCounter = 0;
- do {
- do {
- pdVar1 = readdir(__dirp);
- if (pdVar1 == (dirent *)0x0) {
- closedir(__dirp);
- print();
- print();
- return;
- }
- __s = pdVar1->d_name;
- sVar2 = strlen(__s);
- bVar7 = sVar2 == 8;
- } while (sVar2 < 9);
- iVar4 = 5;
- pcVar5 = pdVar1->d_name + (sVar2 - 4);
- pcVar6 = ".sec";
- do {
- if (iVar4 == 0) break;
- iVar4 = iVar4 + -1;
- bVar7 = *pcVar5 == *pcVar6;
- pcVar5 = pcVar5 + 1;
- pcVar6 = pcVar6 + 1;
- } while (bVar7);
- if (bVar7) {
- iVar4 = sscanf(__s,"%d-%d-%d.sec",&SectorCounter,&x,&y);
- if (iVar4 == 3) {
- sprintf((char *)&z,"%s/%s",MAPPATH,__s);
- LoadSector((char *)&z,SectorCounter,x,y);
- }
- }
- } while( true );
-}
-
-
-
void SaveObjects(Object *Obj,TWriteStream *Stream,bool Stop)
{
@@ -9442,193 +7035,6 @@ void SaveObjects(TReadStream *Stream,TWriteScriptFile *Script)
return;
}
-
-
-void SaveSector(char *FileName,int x,int y,int z)
-
-{
- int iVar1;
- TSector *pTVar2;
- bool bVar3;
- bool bVar4;
- matrix3d<TSector*> *pmVar5;
- byte bVar6;
- int iVar7;
- TSector **ppTVar8;
- int iVar9;
- int iVar10;
- TSector *Sec;
- int Flags;
- char *__fd;
- int in_stack_ffffef5c;
- int local_106c;
- int yy;
- int xx;
- bool Empty;
- undefined1 local_105c [4];
- TReadBuffer ReadBuffer;
- _func_int_varargs **local_103c;
- Object Obj;
- undefined1 local_102c [4];
- TWriteScriptFile Script;
-
- pmVar5 = Sector;
- iVar10 = y - Sector->ymin;
- iVar7 = z - Sector->zmin;
- iVar9 = x - Sector->xmin;
- if (((((iVar9 < 0) || (iVar1 = Sector->dx, iVar1 <= iVar9)) || (iVar10 < 0)) ||
- ((Sector->dy <= iVar10 || (iVar7 < 0)))) || (Sector->dz <= iVar7)) {
- in_stack_ffffef5c = iVar10 + Sector->ymin;
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",iVar9 + Sector->xmin,
- in_stack_ffffef5c,iVar7 + Sector->zmin);
- ppTVar8 = pmVar5->entry;
- }
- else {
- ppTVar8 = Sector->entry + iVar7 * iVar1 * Sector->dy + iVar10 * iVar1 + iVar9;
- }
- pTVar2 = *ppTVar8;
- if (pTVar2 != (TSector *)0x0) {
- TWriteScriptFile::TWriteScriptFile((TWriteScriptFile *)local_102c);
- // try { // try from 0805d5d8 to 0805d76d has its CatchHandler @ 0805d923
- TWriteScriptFile::open((TWriteScriptFile *)local_102c,FileName,in_stack_ffffef5c);
- print();
- TWriteScriptFile::writeText
- ((TWriteScriptFile *)local_102c,"# Tibia - graphical Multi-User-Dungeon");
- TWriteScriptFile::writeLn((TWriteScriptFile *)local_102c);
- TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"# Data for sector ");
- TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,x);
- TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"/");
- TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,y);
- TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"/");
- TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,z);
- TWriteScriptFile::writeLn((TWriteScriptFile *)local_102c);
- TWriteScriptFile::writeLn((TWriteScriptFile *)local_102c);
- bVar4 = true;
- yy = 0;
- do {
- local_106c = 0;
- do {
- __fd = (char *)(x * 0x20 + yy);
- GetFirstObject();
- ReadBuffer.Position = pTVar2->MapCon[yy][local_106c].ObjectID;
- bVar6 = GetMapContainerFlags((Object *)&ReadBuffer.Position);
- bVar3 = false;
- ReadBuffer.Position = NONE.ObjectID;
- if ((local_103c == (_func_int_varargs **)NONE.ObjectID) && (bVar6 == 0)) {
- bVar3 = true;
- }
- if (!bVar3) {
- TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,yy);
- TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"-");
- TWriteScriptFile::writeNumber((TWriteScriptFile *)local_102c,local_106c);
- __fd = &DAT_080f2ab7;
- TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,": ");
- if ((bVar6 & 1) != 0) {
- __fd = "Refresh, ";
- TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"Refresh, ");
- }
- if ((bVar6 & 2) != 0) {
- __fd = "NoLogout, ";
- TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"NoLogout, ");
- }
- if ((bVar6 & 4) != 0) {
- __fd = "ProtectionZone, ";
- TWriteScriptFile::writeText
- ((TWriteScriptFile *)local_102c,"ProtectionZone, ");
- }
- ReadBuffer.Position = NONE.ObjectID;
- local_105c = (undefined1 [4])NONE.ObjectID;
- if (local_103c != (_func_int_varargs **)NONE.ObjectID) {
- TWriteScriptFile::writeText((TWriteScriptFile *)local_102c,"Content=");
- HelpBuffer.super_TWriteBuffer.Position = 0;
- local_105c = (undefined1 [4])local_103c;
- SaveObjects((Object *)local_105c,(TWriteStream *)&HelpBuffer,false);
- TReadBuffer::TReadBuffer
- ((TReadBuffer *)local_105c,HelpBuffer.super_TWriteBuffer.Data,
- HelpBuffer.super_TWriteBuffer.Position);
- __fd = (char *)local_102c;
- SaveObjects((TReadStream *)local_105c,(TWriteScriptFile *)local_102c);
- }
- TWriteScriptFile::writeLn((TWriteScriptFile *)local_102c);
- bVar4 = false;
- }
- local_106c = local_106c + 1;
- } while (local_106c < 0x20);
- yy = yy + 1;
- } while (yy < 0x20);
- TWriteScriptFile::close((TWriteScriptFile *)local_102c,(int)__fd);
- if (bVar4) {
- // try { // try from 0805d7ac to 0805d8f2 has its CatchHandler @ 0805d923
- error("SaveSector: Sektor %d/%d/%d ist leer.\n",x,y,z);
- unlink(FileName);
- __fd = (char *)x;
- }
- TWriteScriptFile::~TWriteScriptFile((TWriteScriptFile *)local_102c,(int)__fd);
- }
- return;
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void SaveMap(void)
-
-{
- int iVar1;
- int iVar2;
- int iVar3;
- int z;
- int iVar4;
- int y;
- int y_00;
- int x;
- int x_00;
- char local_101c [4];
- char FileName [4096];
-
- if (SaveMap::SavingMap) {
- error("SaveMap: Karte wird schon gespeichert.\n");
- }
- else {
- SaveMap::SavingMap = true;
- print();
- ObjectCounter = 0;
- iVar2 = SectorXMax;
- iVar3 = SectorYMax;
- x_00 = SectorXMin;
- if (SectorXMin <= SectorXMax) {
- do {
- iVar1 = SectorZMax;
- y_00 = SectorYMin;
- if (SectorYMin <= iVar3) {
- do {
- iVar2 = SectorZMin;
- if (SectorZMin <= iVar1) {
- do {
- sprintf(local_101c,"%s/%04u-%04u-%02u.sec",MAPPATH,x_00,y_00,iVar2);
- iVar4 = iVar2 + 1;
- SaveSector(local_101c,x_00,y_00,iVar2);
- iVar1 = SectorZMax;
- iVar3 = SectorYMax;
- iVar2 = iVar4;
- } while (iVar4 <= SectorZMax);
- }
- y_00 = y_00 + 1;
- iVar2 = SectorXMax;
- } while (y_00 <= iVar3);
- }
- x_00 = x_00 + 1;
- } while (x_00 <= iVar2);
- }
- print();
- SaveMap::SavingMap = false;
- }
- return;
-}
-
-
-
void RefreshSector(int x,int y,int z,TReadStream *Stream)
{
@@ -10295,579 +7701,6 @@ LAB_0805e958:
goto LAB_0805e966;
}
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void ReadMapConfig(void)
-
-{
- TReadScriptFile *pTVar1;
- char *pcVar2;
- TMark *pTVar3;
- size_t sVar4;
- TDepotInfo *pTVar5;
- undefined4 *puVar6;
- int iVar7;
- undefined1 uVar8;
- int *__s;
- char *pcVar9;
- int *piVar10;
- int DepotNumber;
- char Ident [30];
- TReadScriptFile Script;
- int local_101c;
- char FileName [4096];
-
- NewbieStartPositionY = 0;
- SectorYMin = 1000;
- SectorYMax = 0x3f7;
- SectorZMax = 0xf;
- RefreshedCylinders = 1;
- SectorXMax = 0x3f7;
- HashTableSize = 0x100000;
- SectorXMin = 1000;
- SectorZMin = 0;
- OBCount = 0xa0000;
- NewbieStartPositionX = 0;
- VeteranStartPositionX = 0;
- __s = &local_101c;
- Marks = 0;
- NewbieStartPositionZ = 0;
- VeteranStartPositionY = 0;
- VeteranStartPositionZ = 0;
- pcVar9 = DATAPATH;
- sprintf((char *)__s,"%s/map.dat");
- // try { // try from 0805f114 to 0805f118 has its CatchHandler @ 0805f850
- TReadScriptFile::TReadScriptFile((TReadScriptFile *)(Ident + 0x1c));
- // try { // try from 0805f126 to 0805f5e6 has its CatchHandler @ 0805f831
- TReadScriptFile::open((TReadScriptFile *)(Ident + 0x1c),(char *)__s,(int)pcVar9);
- do {
- TReadScriptFile::nextToken((TReadScriptFile *)(Ident + 0x1c));
- if (stack0xffffb004 == 0) {
- TReadScriptFile::close((TReadScriptFile *)(Ident + 0x1c),(int)__s);
- if (SectorXMin < 1) {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "illegal value for SectorXMin";
- }
- else if (SectorXMax < 0x7ff) {
- if (SectorYMin < 1) {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "illegal value for SectorYMin";
- }
- else if (SectorYMax < 0x7ff) {
- if (SectorZMin < 0) {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "illegal value for SectorZMin";
- }
- else if (SectorZMax < 0x10) {
- if (SectorXMax < SectorXMin) {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "SectorXMin is greater than SectorXMax";
- }
- else if (SectorYMax < SectorYMin) {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "SectorYMin is greater than SectorYMax";
- }
- else if (SectorZMax < SectorZMin) {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "SectorZMin is greater than SectorZMax";
- }
- else if ((OBCount & 0x7fffU) == 0) {
- if (OBCount < 1) {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "illegal value for CacheSize";
- }
- else {
- if (0x7fffffff < (uint)OBCount) {
- OBCount = OBCount + 0x7fff;
- }
- OBCount = OBCount >> 0xf;
- if (HashTableSize < 1) {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "illegal value for Objects";
- }
- else if ((HashTableSize - 1U & HashTableSize) == 0) {
- if (NewbieStartPositionX == 0) {
- puVar6 = (undefined4 *)
- __cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "no start position for newbies specified";
- }
- else {
- if (VeteranStartPositionX != 0) {
- // try { // try from 0805f6c4 to 0805f6c8 has its CatchHandler @ 0805f850
- TReadScriptFile::~TReadScriptFile
- ((TReadScriptFile *)(Ident + 0x1c),(int)__s);
- return;
- }
- puVar6 = (undefined4 *)
- __cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "no start position for veterans specified";
- }
- }
- else {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "Objects must be a power of 2";
- }
- }
- }
- else {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "CacheSize must be a multiple of 32768";
- }
- }
- else {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "illegal value for SectorZMax";
- }
- }
- else {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "illegal value for SectorYMax";
- }
- }
- else {
- puVar6 = (undefined4 *)__cxa_allocate_exception(4,__s,pcVar9);
- *puVar6 = "illegal value for SectorXMax";
- }
- // WARNING: Subroutine does not return
- // try { // try from 0805f6f9 to 0805f6fd has its CatchHandler @ 0805f831
- __cxa_throw(puVar6,char_const*::typeinfo,0);
- }
- uVar8 = stack0xffffb004 == 1;
- if (!(bool)uVar8) {
- TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"Identifier expected");
- }
- pcVar2 = TReadScriptFile::getIdentifier((TReadScriptFile *)(Ident + 0x1c));
- strcpy((char *)&DepotNumber,pcVar2);
- __s = (int *)0x3d;
- TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'=');
- iVar7 = 0xb;
- piVar10 = &DepotNumber;
- pcVar2 = "sectorxmin";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- SectorXMin = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- }
- iVar7 = 0xb;
- piVar10 = &DepotNumber;
- pcVar2 = "sectorxmax";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- SectorXMax = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- }
- iVar7 = 0xb;
- piVar10 = &DepotNumber;
- pcVar2 = "sectorymin";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- SectorYMin = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- }
- iVar7 = 0xb;
- piVar10 = &DepotNumber;
- pcVar2 = "sectorymax";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- SectorYMax = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- }
- iVar7 = 0xb;
- piVar10 = &DepotNumber;
- pcVar2 = "sectorzmin";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- SectorZMin = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- }
- iVar7 = 0xb;
- piVar10 = &DepotNumber;
- pcVar2 = "sectorzmax";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- SectorZMax = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- }
- iVar7 = 0x13;
- piVar10 = &DepotNumber;
- pcVar2 = "refreshedcylinders";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- RefreshedCylinders = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- }
- iVar7 = 8;
- piVar10 = &DepotNumber;
- pcVar2 = "objects";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- HashTableSize = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- }
- iVar7 = 10;
- piVar10 = &DepotNumber;
- pcVar2 = "cachesize";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- OBCount = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- }
- iVar7 = 6;
- piVar10 = &DepotNumber;
- pcVar2 = "depot";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'(');
- iVar7 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- pTVar1 = (TReadScriptFile *)(Ident + 0x1c);
- TReadScriptFile::readSymbol(pTVar1,',');
- TReadScriptFile::nextToken(pTVar1);
- if (stack0xffffb004 != 3) {
- TReadScriptFile::error(pTVar1,"town name expected");
- }
- pcVar2 = TReadScriptFile::getString((TReadScriptFile *)(Ident + 0x1c));
- sVar4 = strlen(pcVar2);
- uVar8 = sVar4 == 0x13;
- if (0x13 < sVar4) {
- TReadScriptFile::error((TReadScriptFile *)(Ident + 0x1c),"town name too long");
- }
- pcVar2 = TReadScriptFile::getString((TReadScriptFile *)(Ident + 0x1c));
- pTVar5 = vector<TDepotInfo>::operator()(&DepotInfo,iVar7);
- strcpy(pTVar5->Town,pcVar2);
- TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),',');
- pTVar5 = vector<TDepotInfo>::operator()(&DepotInfo,iVar7);
- iVar7 = TReadScriptFile::readNumber((TReadScriptFile *)(Ident + 0x1c));
- pTVar5->Size = iVar7;
- __s = (int *)0x29;
- TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),')');
- }
- iVar7 = 5;
- piVar10 = &DepotNumber;
- pcVar2 = "mark";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- TReadScriptFile::readSymbol((TReadScriptFile *)(Ident + 0x1c),'(');
- pcVar9 = TReadScriptFile::readString((TReadScriptFile *)(Ident + 0x1c));
- pTVar3 = vector<TMark>::operator()(&Mark,Marks);
- pTVar1 = (TReadScriptFile *)(Ident + 0x1c);
- strcpy(pTVar3->Name,pcVar9);
- TReadScriptFile::readSymbol(pTVar1,',');
- vector<TMark>::operator()(&Mark,Marks);
- pTVar3 = vector<TMark>::operator()(&Mark,Marks);
- pcVar9 = (char *)&pTVar3->y;
- vector<TMark>::operator()(&Mark,Marks);
- TReadScriptFile::readCoordinate(pTVar1);
- __s = (int *)0x29;
- TReadScriptFile::readSymbol(pTVar1,')');
- Marks = Marks + 1;
- uVar8 = Marks == 0;
- }
- iVar7 = 0xc;
- piVar10 = &DepotNumber;
- pcVar2 = "newbiestart";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- piVar10 = &NewbieStartPositionY;
- __s = &NewbieStartPositionX;
- TReadScriptFile::readCoordinate((TReadScriptFile *)(Ident + 0x1c));
- pcVar9 = (char *)piVar10;
- }
- iVar7 = 0xd;
- piVar10 = &DepotNumber;
- pcVar2 = "veteranstart";
- do {
- if (iVar7 == 0) break;
- iVar7 = iVar7 + -1;
- uVar8 = (char)*piVar10 == *pcVar2;
- piVar10 = (int *)((int)piVar10 + 1);
- pcVar2 = pcVar2 + 1;
- } while ((bool)uVar8);
- if ((bool)uVar8) {
- piVar10 = &VeteranStartPositionY;
- __s = &VeteranStartPositionX;
- TReadScriptFile::readCoordinate((TReadScriptFile *)(Ident + 0x1c));
- pcVar9 = (char *)piVar10;
- }
- } while( true );
-}
-
-
-
-// WARNING: Unknown calling convention -- yet parameter storage is locked
-
-void InitMap(void)
-
-{
- int iVar1;
- ulong *puVar2;
- TObjectBlock **ppTVar3;
- ulong *puVar4;
- int i_2;
- matrix3d<TSector*> *this;
- TObject *pTVar5;
- TObjectBlock *pTVar6;
- int j;
- int iVar7;
- int iVar8;
- TObject *Help;
- int i_1;
- int iVar9;
- int i;
- int iVar10;
-
- // try { // try from 0805f869 to 0805f879 has its CatchHandler @ 0805fad4
- ReadMapConfig();
- this = (matrix3d<TSector*> *)operator_new(0x1c);
- // try { // try from 0805f8bd to 0805f8c1 has its CatchHandler @ 0805fab7
- matrix3d<TSector*>::matrix3d
- (this,SectorXMin,SectorXMax,SectorYMin,SectorYMax,SectorZMin,SectorZMax,(TSector *)0x0
- );
- Sector = this;
- // try { // try from 0805f8c8 to 0805fa67 has its CatchHandler @ 0805fad4
- DeleteSwappedSectors();
- iVar10 = 0;
- ObjectBlock = (TObjectBlock **)malloc(OBCount << 2);
- if (0 < OBCount) {
- do {
- ppTVar3 = ObjectBlock;
- pTVar6 = (TObjectBlock *)malloc(0x100000);
- ppTVar3[iVar10] = pTVar6;
- iVar10 = iVar10 + 1;
- } while (iVar10 < OBCount);
- }
- iVar10 = OBCount;
- ppTVar3 = ObjectBlock;
- iVar9 = 0;
- if (0 < OBCount) {
- iVar1 = OBCount + -1;
- do {
- iVar7 = 0;
- do {
- iVar8 = iVar7 + 1;
- ppTVar3[iVar9]->Object[iVar7].NextObject.ObjectID =
- (ulong)(ppTVar3[iVar9]->Object + iVar7 + 1);
- iVar7 = iVar8;
- } while (iVar8 < 0x7fff);
- if (iVar9 < iVar1) {
- ppTVar3[iVar9]->Object[0x7fff].NextObject.ObjectID = (ulong)ppTVar3[iVar9 + 1];
- }
- else {
- ppTVar3[iVar9]->Object[0x7fff].NextObject.ObjectID = 0;
- }
- iVar9 = iVar9 + 1;
- } while (iVar9 < iVar10);
- }
- FirstFreeObject = (*ObjectBlock)->Object;
- HashTableMask = HashTableSize - 1;
- HashTableData = (ulong *)malloc(HashTableSize << 2);
- HashTableType = (uchar *)malloc(HashTableSize);
- memset(HashTableType,0,HashTableSize);
- HashTableFree = HashTableSize + -1;
- *HashTableType = 0xff;
- puVar4 = HashTableData;
- if (FirstFreeObject == (TObject *)0x0) {
- SwapSector();
- }
- pTVar5 = FirstFreeObject;
- if (FirstFreeObject == (TObject *)0x0) {
- error("GetFreeObjectSlot: Kein freier Platz mehr.\n");
- pTVar5 = (TObject *)0x0;
- }
- else {
- puVar2 = &FirstFreeObject->ObjectID;
- FirstFreeObject = (TObject *)(FirstFreeObject->NextObject).ObjectID;
- *puVar2 = 0;
- (pTVar5->NextObject).ObjectID = 0;
- (pTVar5->Container).ObjectID = 0;
- (pTVar5->Type).TypeID = 0;
- pTVar5->Attributes[0] = 0;
- pTVar5->Attributes[1] = 0;
- pTVar5->Attributes[2] = 0;
- pTVar5->Attributes[3] = 0;
- }
- *puVar4 = (ulong)pTVar5;
- iVar10 = 0;
- do {
- CronHashTable[iVar10] = -1;
- iVar10 = iVar10 + 1;
- } while (iVar10 < 0x7ff);
- CronEntries = 0;
- LoadMap();
- return;
-}
-
-
-
-// WARNING: Variable defined which should be unmapped: x
-
-void ExitMap(bool save)
-
-{
- TObjectBlock **ppTVar1;
- int iVar2;
- TSector **ppTVar3;
- int iVar4;
- int iVar5;
- int i;
- int iVar6;
- matrix3d<TSector*> *pmVar7;
- int local_1c;
- int z;
- int y;
- int x;
-
- if (save) {
- SaveMap();
- }
- iVar6 = 0;
- free(HashTableType);
- free(HashTableData);
- if (0 < OBCount) {
- do {
- ppTVar1 = ObjectBlock + iVar6;
- iVar6 = iVar6 + 1;
- free(*ppTVar1);
- } while (iVar6 < OBCount);
- }
- free(ObjectBlock);
- y = SectorXMin;
- iVar6 = SectorXMax;
- iVar4 = SectorYMax;
- pmVar7 = Sector;
- if (SectorXMin <= SectorXMax) {
- do {
- z = SectorYMin;
- iVar5 = SectorZMax;
- if (SectorYMin <= iVar4) {
- do {
- local_1c = SectorZMin;
- if (SectorZMin <= iVar5) {
- do {
- iVar5 = z - pmVar7->ymin;
- iVar6 = local_1c - pmVar7->zmin;
- iVar4 = y - pmVar7->xmin;
- if ((((iVar4 < 0) || (iVar2 = pmVar7->dx, iVar2 <= iVar4)) ||
- (iVar5 < 0)) ||
- (((pmVar7->dy <= iVar5 || (iVar6 < 0)) || (pmVar7->dz <= iVar6)))) {
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",
- iVar4 + pmVar7->xmin,iVar5 + pmVar7->ymin,iVar6 + pmVar7->zmin
- );
- ppTVar3 = pmVar7->entry;
- pmVar7 = Sector;
- }
- else {
- ppTVar3 = pmVar7->entry +
- iVar6 * iVar2 * pmVar7->dy + iVar5 * iVar2 + iVar4;
- }
- if (*ppTVar3 != (TSector *)0x0) {
- iVar5 = z - pmVar7->ymin;
- iVar6 = local_1c - pmVar7->zmin;
- iVar4 = y - pmVar7->xmin;
- if (((iVar4 < 0) || (iVar2 = pmVar7->dx, iVar2 <= iVar4)) ||
- ((iVar5 < 0 ||
- (((pmVar7->dy <= iVar5 || (iVar6 < 0)) || (pmVar7->dz <= iVar6))
- )))) {
- error("matrix3d::operator(): Ungueltiger Index %d/%d/%d.\n",
- iVar4 + pmVar7->xmin,iVar5 + pmVar7->ymin,
- iVar6 + pmVar7->zmin);
- ppTVar3 = pmVar7->entry;
- }
- else {
- ppTVar3 = pmVar7->entry +
- iVar6 * iVar2 * pmVar7->dy + iVar5 * iVar2 + iVar4;
- }
- free(*ppTVar3);
- pmVar7 = Sector;
- }
- local_1c = local_1c + 1;
- iVar5 = SectorZMax;
- iVar4 = SectorYMax;
- } while (local_1c <= SectorZMax);
- }
- z = z + 1;
- iVar6 = SectorXMax;
- } while (z <= iVar4);
- }
- y = y + 1;
- } while (y <= iVar6);
- }
- if (pmVar7 != (matrix3d<TSector*> *)0x0) {
- if (pmVar7->entry != (TSector **)0x0) {
- operator_delete__(pmVar7->entry);
- }
- operator_delete(pmVar7);
- }
- DeleteSwappedSectors();
- return;
-}
-
-
-
void __tcf_0(void *param_1)
{