Mercurial > mm7
comparison Indoor.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 | 7887a9cf9e7b |
children | 35f28d4c0ff9 |
comparison
equal
deleted
inserted
replaced
514:0bbc39457b25 | 515:cb0ad52d6a26 |
---|---|
1 #include <assert.h> | 1 #include <assert.h> |
2 | 2 |
3 #include "Outdoor.h" | 3 #include "Outdoor.h" |
4 #include "Render.h" | 4 #include "Render.h" |
5 #include "LayingItem.h" | 5 #include "SpriteObject.h" |
6 #include "Events.h" | 6 #include "Events.h" |
7 #include "Game.h" | 7 #include "Game.h" |
8 #include "Viewport.h" | 8 #include "Viewport.h" |
9 #include "Time.h" | 9 #include "Time.h" |
10 #include "Party.h" | 10 #include "Party.h" |
1890 int v70; // ecx@38 | 1890 int v70; // ecx@38 |
1891 int v71; // edx@38 | 1891 int v71; // edx@38 |
1892 int v72; // eax@38 | 1892 int v72; // eax@38 |
1893 unsigned __int16 v73; // ax@42 | 1893 unsigned __int16 v73; // ax@42 |
1894 char *v74; // ecx@42 | 1894 char *v74; // ecx@42 |
1895 LayingItem *v75; // ecx@44 | 1895 SpriteObject *v75; // ecx@44 |
1896 size_t v76; // eax@45 | 1896 size_t v76; // eax@45 |
1897 int j; // edx@46 | 1897 int j; // edx@46 |
1898 unsigned __int16 v78; // ax@50 | 1898 unsigned __int16 v78; // ax@50 |
1899 void *v79; // eax@52 | 1899 void *v79; // eax@52 |
1900 void **v80; // esi@52 | 1900 void **v80; // esi@52 |
2360 *(short *)v74 = v73; | 2360 *(short *)v74 = v73; |
2361 } | 2361 } |
2362 while ( Argsi < (signed int)uNumLevelDecorations ); | 2362 while ( Argsi < (signed int)uNumLevelDecorations ); |
2363 } | 2363 } |
2364 fseek(v7, v219, 0); | 2364 fseek(v7, v219, 0); |
2365 fread(&uNumLayingItems, 4u, 1u, v7); | 2365 fread(&uNumSpriteObjects, 4u, 1u, v7); |
2366 fseek(v7, v220, 0); | 2366 fseek(v7, v220, 0); |
2367 fread(pLayingItems, 0x70u, uNumLayingItems, v7); | 2367 fread(pSpriteObjects, 0x70u, uNumSpriteObjects, v7); |
2368 if ( (signed int)uNumLayingItems > 0 ) | 2368 if ( (signed int)uNumSpriteObjects > 0 ) |
2369 { | 2369 { |
2370 v75 = pLayingItems; | 2370 v75 = pSpriteObjects; |
2371 pDest = (char *)uNumLayingItems; | 2371 pDest = (char *)uNumSpriteObjects; |
2372 do | 2372 do |
2373 { | 2373 { |
2374 Argsj = 0; | 2374 Argsj = 0; |
2375 v76 = 48 * v75->stru_24.uItemID; | 2375 v76 = 48 * v75->stru_24.uItemID; |
2376 v11 = pObjectList->uNumObjects == 0; | 2376 v11 = pObjectList->uNumObjects == 0; |
2515 assert(sizeof(BLVLightMM7) == 16); | 2515 assert(sizeof(BLVLightMM7) == 16); |
2516 assert(sizeof(BSPNode) == 8); | 2516 assert(sizeof(BSPNode) == 8); |
2517 assert(sizeof(SpawnPointMM7) == 24); | 2517 assert(sizeof(SpawnPointMM7) == 24); |
2518 assert(sizeof(DDM_DLV_Header) == 40); | 2518 assert(sizeof(DDM_DLV_Header) == 40); |
2519 assert(sizeof(Actor) == 836); | 2519 assert(sizeof(Actor) == 836); |
2520 assert(sizeof(LayingItem) == 112); | 2520 assert(sizeof(SpriteObject) == 112); |
2521 assert(sizeof(Chest) == 5324); | 2521 assert(sizeof(Chest) == 5324); |
2522 assert(sizeof(stru123) == 0xC8); | 2522 assert(sizeof(stru123) == 0xC8); |
2523 assert(sizeof(BLVMapOutline) == 12); | 2523 assert(sizeof(BLVMapOutline) == 12); |
2524 | 2524 |
2525 bLoaded = true; | 2525 bLoaded = true; |
2970 pData += 4 + uNumActors * sizeof(Actor); | 2970 pData += 4 + uNumActors * sizeof(Actor); |
2971 | 2971 |
2972 pGameLoadingUI_ProgressBar->Progress(); | 2972 pGameLoadingUI_ProgressBar->Progress(); |
2973 pGameLoadingUI_ProgressBar->Progress(); | 2973 pGameLoadingUI_ProgressBar->Progress(); |
2974 | 2974 |
2975 memcpy(&uNumLayingItems, pData, 4); | 2975 memcpy(&uNumSpriteObjects, pData, 4); |
2976 memcpy(pLayingItems, pData + 4, uNumLayingItems * sizeof(LayingItem)); | 2976 memcpy(pSpriteObjects, pData + 4, uNumSpriteObjects * sizeof(SpriteObject)); |
2977 pData += 4 + uNumLayingItems * sizeof(LayingItem); | 2977 pData += 4 + uNumSpriteObjects * sizeof(SpriteObject); |
2978 | 2978 |
2979 pGameLoadingUI_ProgressBar->Progress(); | 2979 pGameLoadingUI_ProgressBar->Progress(); |
2980 | 2980 |
2981 for (uint i = 0; i < uNumLayingItems; ++i) | 2981 for (uint i = 0; i < uNumSpriteObjects; ++i) |
2982 { | 2982 { |
2983 auto pItem = pLayingItems + i; | 2983 auto pItem = pSpriteObjects + i; |
2984 | 2984 |
2985 if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100)) | 2985 if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100)) |
2986 { | 2986 { |
2987 pItem->uItemType = pItemsTable->pItems[pItem->stru_24.uItemID - 1].uSpriteID; | 2987 pItem->uType = pItemsTable->pItems[pItem->stru_24.uItemID - 1].uSpriteID; |
2988 | 2988 |
2989 uint uObjectID = 0; | 2989 uint uObjectID = 0; |
2990 for (uint j = 0; j < pObjectList->uNumObjects; ++j) | 2990 for (uint j = 0; j < pObjectList->uNumObjects; ++j) |
2991 if (pItem->uItemType == pObjectList->pObjects[j].uObjectID) | 2991 if (pItem->uType == pObjectList->pObjects[j].uObjectID) |
2992 { | 2992 { |
2993 pItem->uObjectDescID = j; | 2993 pItem->uObjectDescID = j; |
2994 break; | 2994 break; |
2995 } | 2995 } |
2996 } | 2996 } |
4136 do | 4136 do |
4137 { | 4137 { |
4138 _46E44E_collide_against_faces_and_portals(1u); | 4138 _46E44E_collide_against_faces_and_portals(1u); |
4139 _46E0B2_collide_against_decorations(); | 4139 _46E0B2_collide_against_decorations(); |
4140 _46EF01_collision_chech_player(0); | 4140 _46EF01_collision_chech_player(0); |
4141 _46ED8A_collide_against_layingItems(_this); | 4141 _46ED8A_collide_against_sprite_objects(_this); |
4142 v25 = 0; | 4142 v25 = 0; |
4143 v56 = 0; | 4143 v56 = 0; |
4144 if ( ai_arrays_size > v22 ) | 4144 if ( ai_arrays_size > v22 ) |
4145 { | 4145 { |
4146 do | 4146 do |
4485 if ( v6 == 1 ) | 4485 if ( v6 == 1 ) |
4486 Abortf("Out of memory loading indoor level"); | 4486 Abortf("Out of memory loading indoor level"); |
4487 if ( !(dword_6BE364_game_settings_1 & 0x2000) ) | 4487 if ( !(dword_6BE364_game_settings_1 & 0x2000) ) |
4488 { | 4488 { |
4489 InitializeActors(); | 4489 InitializeActors(); |
4490 InitializeLayingItems(); | 4490 InitializeSpriteObjects(); |
4491 } | 4491 } |
4492 BYTE1(dword_6BE364_game_settings_1) &= 0xDFu; | 4492 BYTE1(dword_6BE364_game_settings_1) &= 0xDFu; |
4493 if ( !v39 ) | 4493 if ( !v39 ) |
4494 pDest = 0; | 4494 pDest = 0; |
4495 if ( pDest == 1 ) | 4495 if ( pDest == 1 ) |
4656 } | 4656 } |
4657 } | 4657 } |
4658 | 4658 |
4659 pGameLoadingUI_ProgressBar->Progress(); | 4659 pGameLoadingUI_ProgressBar->Progress(); |
4660 | 4660 |
4661 for (uint i = 0; i < uNumLayingItems; ++i) | 4661 for (uint i = 0; i < uNumSpriteObjects; ++i) |
4662 { | 4662 { |
4663 auto p = pLayingItems + i; | 4663 auto p = pSpriteObjects + i; |
4664 if (p->uObjectDescID) | 4664 if (p->uObjectDescID) |
4665 { | 4665 { |
4666 auto uItemID = p->stru_24.uItemID; | 4666 auto uItemID = p->stru_24.uItemID; |
4667 if (uItemID) | 4667 if (uItemID) |
4668 { | 4668 { |