comparison mm7_1.cpp @ 515:cb0ad52d6a26

LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people) Some object-related subs moved to SpriteObject.cpp
author Nomad
date Fri, 01 Mar 2013 21:13:12 +0200
parents 7c86030324a5
children 35f28d4c0ff9
comparison
equal deleted inserted replaced
514:0bbc39457b25 515:cb0ad52d6a26
27 #include "Allocator.h" 27 #include "Allocator.h"
28 #include "Events.h" 28 #include "Events.h"
29 #include "Viewport.h" 29 #include "Viewport.h"
30 #include "FrameTableInc.h" 30 #include "FrameTableInc.h"
31 #include "Math.h" 31 #include "Math.h"
32 #include "LayingItem.h" 32 #include "SpriteObject.h"
33 #include "ObjectList.h" 33 #include "ObjectList.h"
34 #include "Chest.h" 34 #include "Chest.h"
35 #include "PaletteManager.h" 35 #include "PaletteManager.h"
36 #include "DecorationList.h" 36 #include "DecorationList.h"
37 #include "SaveLoad.h" 37 #include "SaveLoad.h"
4022 POINT *v1; // esi@2 4022 POINT *v1; // esi@2
4023 int v2; // eax@2 4023 int v2; // eax@2
4024 int v3; // ebx@4 4024 int v3; // ebx@4
4025 int v4; // esi@6 4025 int v4; // esi@6
4026 int v5; // ecx@6 4026 int v5; // ecx@6
4027 //LayingItem v6; // [sp+Ch] [bp-80h]@1 4027 //SpriteObject v6; // [sp+Ch] [bp-80h]@1
4028 char v7; // [sp+7Ch] [bp-10h]@2 4028 char v7; // [sp+7Ch] [bp-10h]@2
4029 POINT a2; // [sp+84h] [bp-8h]@2 4029 POINT a2; // [sp+84h] [bp-8h]@2
4030 4030
4031 LayingItem v6; // [sp+Ch] [bp-80h]@1 4031 SpriteObject v6; // [sp+Ch] [bp-80h]@1
4032 //LayingItem::LayingItem(&v6); 4032 //SpriteObject::SpriteObject(&v6);
4033 4033
4034 v0 = pGUIWindow_CurrentMenu->ptr_1C; 4034 v0 = pGUIWindow_CurrentMenu->ptr_1C;
4035 if ( pParty->pPickedItem.uItemID ) 4035 if ( pParty->pPickedItem.uItemID )
4036 { 4036 {
4037 if ( Chest::_41FFA2(-1, &pParty->pPickedItem, (unsigned int)pGUIWindow_CurrentMenu->ptr_1C) ) 4037 if ( Chest::_41FFA2(-1, &pParty->pPickedItem, (unsigned int)pGUIWindow_CurrentMenu->ptr_1C) )
4153 pMouse->uPointingObjectID = (unsigned __int16)v18; 4153 pMouse->uPointingObjectID = (unsigned __int16)v18;
4154 v19 = (signed int)(unsigned __int16)v18 >> 3; 4154 v19 = (signed int)(unsigned __int16)v18 >> 3;
4155 if ( (v18 & 7) == OBJECT_Item ) 4155 if ( (v18 & 7) == OBJECT_Item )
4156 { 4156 {
4157 v30 = v19; 4157 v30 = v19;
4158 if ( pObjectList->pObjects[pLayingItems[v30].uObjectDescID].uFlags & 0x10 ) 4158 if ( pObjectList->pObjects[pSpriteObjects[v30].uObjectDescID].uFlags & 0x10 )
4159 //goto LABEL_73; 4159 //goto LABEL_73;
4160 { 4160 {
4161 pMouse->uPointingObjectID = 0; 4161 pMouse->uPointingObjectID = 0;
4162 //goto LABEL_50; 4162 //goto LABEL_50;
4163 uLastPointedObjectID = 1; 4163 uLastPointedObjectID = 1;
4172 uLastPointedObjectID = pMouse->uPointingObjectID; 4172 uLastPointedObjectID = pMouse->uPointingObjectID;
4173 return; 4173 return;
4174 } 4174 }
4175 if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID ) 4175 if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID )
4176 { 4176 {
4177 v22 = pLayingItems[v30].stru_24.GetDisplayName(); 4177 v22 = pSpriteObjects[v30].stru_24.GetDisplayName();
4178 //LABEL_93: 4178 //LABEL_93:
4179 v26 = v22; 4179 v26 = v22;
4180 //goto LABEL_87; 4180 //goto LABEL_87;
4181 sub_41C0B8_set_status_string(v26); 4181 sub_41C0B8_set_status_string(v26);
4182 if ( pMouse->uPointingObjectID == 0 ) 4182 if ( pMouse->uPointingObjectID == 0 )
4188 } 4188 }
4189 } 4189 }
4190 uLastPointedObjectID = pMouse->uPointingObjectID; 4190 uLastPointedObjectID = pMouse->uPointingObjectID;
4191 return; 4191 return;
4192 } 4192 }
4193 v31 = pLayingItems[v30].stru_24.GetDisplayName(); 4193 v31 = pSpriteObjects[v30].stru_24.GetDisplayName();
4194 v28 = pTmpBuf; 4194 v28 = pTmpBuf;
4195 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s" 4195 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s"
4196 } 4196 }
4197 else 4197 else
4198 { 4198 {
4845 int v4; // eax@6 4845 int v4; // eax@6
4846 unsigned __int16 v5; // dx@11 4846 unsigned __int16 v5; // dx@11
4847 signed int v6; // eax@11 4847 signed int v6; // eax@11
4848 char *v7; // edi@12 4848 char *v7; // edi@12
4849 __int16 v8; // ax@16 4849 __int16 v8; // ax@16
4850 LayingItem a1; // [sp+4h] [bp-78h]@11 4850 SpriteObject a1; // [sp+4h] [bp-78h]@11
4851 int v11; // [sp+74h] [bp-8h]@2 4851 int v11; // [sp+74h] [bp-8h]@2
4852 int v12; // [sp+78h] [bp-4h]@5 4852 int v12; // [sp+78h] [bp-4h]@5
4853 4853
4854 if ( !pParty->pPickedItem.uItemID ) 4854 if ( !pParty->pPickedItem.uItemID )
4855 return 1; 4855 return 1;
4882 } 4882 }
4883 if ( v12 == 4 ) 4883 if ( v12 == 4 )
4884 { 4884 {
4885 v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; 4885 v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
4886 v6 = 0; 4886 v6 = 0;
4887 a1.uItemType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; 4887 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
4888 if ( (signed int)pObjectList->uNumObjects <= 0 ) 4888 if ( (signed int)pObjectList->uNumObjects <= 0 )
4889 { 4889 {
4890 LOWORD(v6) = 0; 4890 LOWORD(v6) = 0;
4891 } 4891 }
4892 else 4892 else
5184 unsigned __int16 v19; // ax@50 5184 unsigned __int16 v19; // ax@50
5185 const char *v20; // eax@51 5185 const char *v20; // eax@51
5186 signed int v21; // eax@58 5186 signed int v21; // eax@58
5187 ItemGen *v22; // esi@62 5187 ItemGen *v22; // esi@62
5188 unsigned int v23; // eax@62 5188 unsigned int v23; // eax@62
5189 LayingItem a1; // [sp+Ch] [bp-80h]@1 5189 SpriteObject a1; // [sp+Ch] [bp-80h]@1
5190 POINT v25; // [sp+7Ch] [bp-10h]@3 5190 POINT v25; // [sp+7Ch] [bp-10h]@3
5191 POINT a2; // [sp+84h] [bp-8h]@3 5191 POINT a2; // [sp+84h] [bp-8h]@3
5192 5192
5193 if ( pRenderer->pRenderD3D ) 5193 if ( pRenderer->pRenderD3D )
5194 { 5194 {
5201 } 5201 }
5202 if ( (v0 & 7) == OBJECT_Item) 5202 if ( (v0 & 7) == OBJECT_Item)
5203 { 5203 {
5204 a2.y = (signed int)(unsigned __int16)v0 >> 3; 5204 a2.y = (signed int)(unsigned __int16)v0 >> 3;
5205 v21 = (signed int)(unsigned __int16)v0 >> 3; 5205 v21 = (signed int)(unsigned __int16)v0 >> 3;
5206 if ( !(pObjectList->pObjects[pLayingItems[v21].uObjectDescID].uFlags & 0x10) 5206 if ( !(pObjectList->pObjects[pSpriteObjects[v21].uObjectDescID].uFlags & 0x10)
5207 && a2.y < 1000 5207 && a2.y < 1000
5208 && pLayingItems[v21].uObjectDescID 5208 && pSpriteObjects[v21].uObjectDescID
5209 && (unsigned int)v0 < 0x2000000 ) 5209 && (unsigned int)v0 < 0x2000000 )
5210 { 5210 {
5211 v22 = &pLayingItems[v21].stru_24; 5211 v22 = &pSpriteObjects[v21].stru_24;
5212 v23 = pLayingItems[v21].stru_24.uItemID; 5212 v23 = pSpriteObjects[v21].stru_24.uItemID;
5213 if ( pItemsTable->pItems[v23].uEquipType == 18 ) 5213 if ( pItemsTable->pItems[v23].uEquipType == 18 )
5214 { 5214 {
5215 party_finds_gold(v22->uSpecEnchantmentType, 0); 5215 party_finds_gold(v22->uSpecEnchantmentType, 0);
5216 viewparams->bRedrawGameUI = 1; 5216 viewparams->bRedrawGameUI = 1;
5217 } 5217 }
5224 if ( v22->uItemID == 455 ) 5224 if ( v22->uItemID == 455 )
5225 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u); 5225 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u);
5226 if ( !pParty->AddItem(v22) ) 5226 if ( !pParty->AddItem(v22) )
5227 pParty->SetHoldingItem(v22); 5227 pParty->SetHoldingItem(v22);
5228 } 5228 }
5229 LayingItem::OnItemPickup(a2.y); 5229 SpriteObject::OnInteraction(a2.y);
5230 return; 5230 return;
5231 } 5231 }
5232 goto LABEL_13; 5232 goto LABEL_13;
5233 } 5233 }
5234 if ( (v0 & 7) != OBJECT_Actor) 5234 if ( (v0 & 7) != OBJECT_Actor)
5267 if ( pParty->pPickedItem.uItemID ) 5267 if ( pParty->pPickedItem.uItemID )
5268 { 5268 {
5269 LABEL_14: 5269 LABEL_14:
5270 v5 = pItemsTable->pItems[v4].uSpriteID; 5270 v5 = pItemsTable->pItems[v4].uSpriteID;
5271 v6 = 0; 5271 v6 = 0;
5272 a1.uItemType = v5; 5272 a1.uType = v5;
5273 if ( (signed int)pObjectList->uNumObjects <= 0 ) 5273 if ( (signed int)pObjectList->uNumObjects <= 0 )
5274 { 5274 {
5275 LABEL_18: 5275 LABEL_18:
5276 LOWORD(v6) = 0; 5276 LOWORD(v6) = 0;
5277 } 5277 }