Mercurial > mm7
changeset 1303:dcc52e17b517
m
author | Ritor1 |
---|---|
date | Sun, 23 Jun 2013 14:02:07 +0600 |
parents | d8033eb56d7e |
children | 9d99e7b76cdc |
files | Actor.cpp Arcomage.cpp Arcomage.h DecorationList.cpp GUIWindow.cpp Indoor.cpp ObjectList.cpp Outdoor.cpp SaveLoad.cpp Spells.cpp SpriteObject.cpp Texture.cpp UIHouses.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp |
diffstat | 16 files changed, 1557 insertions(+), 1552 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/Actor.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -33,6 +33,8 @@ #include "MM7.h" #include "SpriteObject.h" +#include "Allocator.h" +#include "PaletteManager.h" @@ -3979,3 +3981,136 @@ } return result; } +//----- (004BBF61) -------------------------------------------------------- +void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z) +{ + size_t v4; // esi@1 + int monster_id; // edi@1 + __int16 v6; // ax@4 + Actor *v7; // esi@5 + int v8; // eax@5 + MonsterInfo *v9; // edi@5 + MonsterDesc *v10; // ebx@5 + unsigned __int16 *v11; // ebx@5 + int v12; // ebx@7 + int v13; // eax@8 + __int16 x_; // [sp+8h] [bp-Ch]@1 + __int16 v15; // [sp+Ch] [bp-8h]@1 + __int16 v16; // [sp+10h] [bp-4h]@3 + signed int ya; // [sp+1Ch] [bp+8h]@5 + + v4 = uNumActors; + monster_id = a1; + x_ = x; + v15 = a1; + if ( (signed int)uNumActors < 500 + && ((signed int)pAllocator->uBigBufferSizeAligned >> 10) - ((signed int)pAllocator->uNextFreeOffsetInBigBuffer >> 10) >= 2000 ) + { + v16 = 0; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + v6 = pIndoor->GetSector(x, y, z); + v4 = uNumActors; + v16 = v6; + } + v7 = &pActors[v4]; + v7->Reset(); + v8 = monster_id; + v9 = &pMonsterStats->pInfos[monster_id]; + v10 = &pMonsterList->pMonsters[v8 - 1]; + strcpy(v7->pActorName, v9->pName); + v7->sCurrentHP = LOWORD(v9->uHP); + memcpy(&v7->pMonsterInfo, v9, 0x58u); + v7->word_000086_some_monster_id = v15; + v7->uActorRadius = v10->uMonsterRadius; + v7->uActorHeight = v10->uMonsterHeight; + v7->uMovementSpeed = v10->uMovementSpeed; + v7->vInitialPosition.x = x_; + v7->vPosition.x = x_; + BYTE2(v7->uAttributes) |= 8u; + v7->pMonsterInfo.uTreasureType = 0; + v7->pMonsterInfo.uTreasureLevel = 0; + v7->pMonsterInfo.uTreasureDiceSides = 0; + v7->pMonsterInfo.uTreasureDiceRolls = 0; + v7->pMonsterInfo.uTreasureDropChance = 0; + v7->vInitialPosition.y = y; + v7->vPosition.y = y; + v7->vInitialPosition.z = z; + v7->vPosition.z = z; + v7->uTetherDistance = 256; + v7->uSectorID = v16; + v7->uGroup = 1; + v7->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + v7->PrepareSprites(0); + v11 = v10->pSoundSampleIDs; + ya = 4; + do + { + pSoundList->LoadSound((signed __int16)*v11, 0); + ++v11; + --ya; + } + while ( ya ); + v12 = 0; + do + LOWORD(v13) = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v9->uSpell1ID], 1u); + while ( v13 ); + ++uNumActors; + } +} +//----- (00450B0A) -------------------------------------------------------- +bool __fastcall SpawnActor(unsigned int uMonsterID) +{ + unsigned int v1; // ebx@1 + bool result; // eax@2 + MonsterDesc *v3; // esi@5 + MonsterInfo *v4; // edi@5 + Vec3_int_ v5; // ST08_12@5 + unsigned int v6; // ecx@5 + Actor *v7; // eax@7 + Actor actor; // [sp+4h] [bp-350h]@5 + Vec3_int_ pOut; // [sp+348h] [bp-Ch]@5 + + v1 = uMonsterID; + if ( uNumActors == 499 ) + { + result = 0; + } + else + { + if ( (signed int)uMonsterID >= (signed int)pMonsterList->uNumMonsters ) + v1 = 0; + v3 = &pMonsterList->pMonsters[v1]; + v4 = &pMonsterStats->pInfos[v1 + 1]; + memset(&actor, 0, 0x344u); + strcpy(actor.pActorName, v4->pName); + actor.sCurrentHP = LOWORD(v4->uHP); + memcpy(&actor.pMonsterInfo, &pMonsterStats->pInfos[v1 + 1], 0x58u); + actor.word_000086_some_monster_id = v1 + 1; + actor.uActorRadius = v3->uMonsterRadius; + actor.uActorHeight = v3->uMonsterHeight; + actor.uMovementSpeed = v3->uMovementSpeed; + v5 = pParty->vPosition; + Vec3_int_::Rotate(200, pParty->sRotationY, 0, v5, &pOut.x, &pOut.z, &pOut.y); + actor.vInitialPosition.x = pOut.x; + actor.vPosition.x = pOut.x; + actor.uTetherDistance = 256; + actor.vInitialPosition.y = LOWORD(pOut.z); + actor.vPosition.y = LOWORD(pOut.z); + actor.vInitialPosition.z = LOWORD(pOut.y); + actor.vPosition.z = LOWORD(pOut.y); + pSprites_LOD->DeleteSomeSprites(); + pPaletteManager->ResetNonTestLocked(); + v6 = uNumActors - 1; + if ( dword_5C6DF8 == 1 ) + { + dword_5C6DF8 = 0; + v6 = uNumActors++; + } + v7 = &pActors[v6]; + memcpy(v7, &actor, 0x344u); + v7->PrepareSprites(1); + result = 1; + } + return result; +} \ No newline at end of file
--- a/Arcomage.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/Arcomage.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -4140,3 +4140,31 @@ { sprintf(pOut, "%d", val); } + +void set_stru1_field_8_InArcomage(int inValue) +{ + switch(inValue) + { + case 91:LOBYTE(pArcomageGame->stru1.field_8) = 123;break; + case 92:LOBYTE(pArcomageGame->stru1.field_8) = 124;break; + case 93:LOBYTE(pArcomageGame->stru1.field_8) = 125;break; + case 96:LOBYTE(pArcomageGame->stru1.field_8) = 126;break; + case 61:LOBYTE(pArcomageGame->stru1.field_8) = 43;break; + case 55:LOBYTE(pArcomageGame->stru1.field_8) = 38;break; + case 56:LOBYTE(pArcomageGame->stru1.field_8) = 42;break; + case 57:LOBYTE(pArcomageGame->stru1.field_8) = 40;break; + case 59:LOBYTE(pArcomageGame->stru1.field_8) = 58;break; + case 54:LOBYTE(pArcomageGame->stru1.field_8) = 94;break; + case 50:LOBYTE(pArcomageGame->stru1.field_8) = 64;break; + case 51:LOBYTE(pArcomageGame->stru1.field_8) = 35;break; + case 52:LOBYTE(pArcomageGame->stru1.field_8) = 36;break; + case 53:LOBYTE(pArcomageGame->stru1.field_8) = 37;break; + case 49:LOBYTE(pArcomageGame->stru1.field_8) = 33;break; + case 39:LOBYTE(pArcomageGame->stru1.field_8) = 34;break; + case 44:LOBYTE(pArcomageGame->stru1.field_8) = 60;break; + case 46:LOBYTE(pArcomageGame->stru1.field_8) = 62;break; + case 47:LOBYTE(pArcomageGame->stru1.field_8) = 63;break; + case 48:LOBYTE(pArcomageGame->stru1.field_8) = 41;break; + default:LOBYTE(pArcomageGame->stru1.field_8) = inValue;break; + } +} \ No newline at end of file
--- a/Arcomage.h Sat Jun 15 23:58:32 2013 +0600 +++ b/Arcomage.h Sun Jun 23 14:02:07 2013 +0600 @@ -188,6 +188,7 @@ extern ArcomageGame *pArcomageGame; extern ArcomageCard pCards[87]; +extern void set_stru1_field_8_InArcomage(int inValue);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DecorationList.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -0,0 +1,266 @@ +#include "DecorationList.h" +#include <string> +#include "Allocator.h" +#include "mm7_data.h" +#include "Sprites.h" +#include "FrameTableInc.h" + + +//----- (00458600) -------------------------------------------------------- +void DecorationList::ToFile() +{ + DecorationList *v1; // esi@1 + FILE *v2; // eax@1 + FILE *v3; // edi@1 + + v1 = this; + v2 = fopen("data\\ddeclist.bin", "wb"); + v3 = v2; + if ( !v2 ) + Abortf("Unable to save ddeclist.bin!"); + fwrite(v1, 4u, 1u, v2); + fwrite(v1->pDecorations, 0x54u, v1->uNumDecorations, v3); + fclose(v3); +} + +//----- (0045864C) -------------------------------------------------------- +void DecorationList::FromFile(void *pSerialized) +{ + uNumDecorations = *(int *)pSerialized; + pDecorations = (DecorationDesc *)pAllocator->AllocNamedChunk(pDecorations, + 84 * uNumDecorations, "Dec Descrip"); + memcpy(pDecorations, (char *)pSerialized + 4, 84 * uNumDecorations); +} + +//----- (00458693) -------------------------------------------------------- +void DecorationList::InitializeDecorationSprite(unsigned int uDecID) +{ + pSpriteFrameTable->InitializeSprite(this->pDecorations[uDecID].uSpriteID); +} + +//----- (004586B0) -------------------------------------------------------- +bool DecorationList::FromFileTxt(const char *Args) +{ + DecorationList *v2; // ebx@1 + FILE *v3; // eax@1 + unsigned int v4; // esi@3 + void *v5; // eax@10 + FILE *v6; // ST18_4@12 + char *i; // eax@12 + unsigned __int16 v8; // ax@16 + const char *v9; // ST20_4@16 + const char *v10; // ST18_4@16 + __int16 v11; // ax@16 + const char *v12; // ST14_4@16 + unsigned __int16 v13; // ax@16 + const char *v14; // ST10_4@16 + __int16 v15; // ax@16 + const char *v16; // ST0C_4@16 + unsigned __int8 v17; // al@16 + const char *v18; // ST08_4@16 + unsigned __int8 v19; // al@16 + const char *v20; // ST04_4@16 + unsigned __int8 v21; // al@16 + const char *v22; // ST00_4@16 + unsigned __int8 v23; // zf@16 + char v24; // sf@16 + unsigned __int8 v25; // of@16 + int j; // edi@17 + const char *v27; // esi@18 + int v28; // eax@19 + int v29; // eax@21 + int v30; // eax@23 + int v31; // eax@25 + int v32; // eax@27 + int v33; // eax@29 + int v34; // eax@31 + int v35; // eax@33 + FrameTableTxtLine v37; // [sp+Ch] [bp-460h]@17 + FrameTableTxtLine v38; // [sp+88h] [bp-3E4h]@13 + char Dest; // [sp+104h] [bp-368h]@17 + char Buf; // [sp+17Ch] [bp-2F0h]@3 + FrameTableTxtLine v41; // [sp+370h] [bp-FCh]@4 + FrameTableTxtLine v42; // [sp+3ECh] [bp-80h]@4 + FILE *File; // [sp+468h] [bp-4h]@1 + unsigned int Argsa; // [sp+474h] [bp+8h]@3 + + v2 = this; + v3 = fopen(Args, "r"); + File = v3; + if ( !v3 ) + Abortf("DecorationDescriptionList::load - Unable to open file: %s."); + v4 = 0; + Argsa = 0; + if ( fgets(&Buf, 490, v3) ) + { + do + { + *strchr(&Buf, 10) = 0; + memcpy(&v42, frame_table_txt_parser(&Buf, &v41), sizeof(v42)); + if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 ) + ++Argsa; + } + while ( fgets(&Buf, 490, File) ); + v4 = Argsa; + } + v2->uNumDecorations = v4; + v5 = pAllocator->AllocNamedChunk(v2->pDecorations, 84 * v4, "Dec Descrip"); + v2->pDecorations = (DecorationDesc *)v5; + if ( !v5 ) + Abortf("DecorationDescriptionList::load - Out of Memory!"); + v6 = File; + v2->uNumDecorations = 0; + fseek(v6, 0, 0); + for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) + { + *strchr(&Buf, 10) = 0; + memcpy(&v42, frame_table_txt_parser(&Buf, &v38), sizeof(v42)); + if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 ) + { + strcpy(v2->pDecorations[v2->uNumDecorations].pName, v42.pProperties[1]); + v8 = pSpriteFrameTable->FastFindSprite(v2->pDecorations[v2->uNumDecorations].pName); + v9 = v42.pProperties[2]; + v2->pDecorations[v2->uNumDecorations].uSpriteID = v8; + strcpy(v2->pDecorations[v2->uNumDecorations].field_20, v9); + v10 = v42.pProperties[3]; + v2->pDecorations[v2->uNumDecorations].uType = 0; + v11 = atoi(v10); + v12 = v42.pProperties[4]; + v2->pDecorations[v2->uNumDecorations].uRadius = v11; + v13 = atoi(v12); + v14 = v42.pProperties[5]; + v2->pDecorations[v2->uNumDecorations].uDecorationHeight = v13; + v15 = atoi(v14); + v16 = v42.pProperties[6]; + v2->pDecorations[v2->uNumDecorations].uLightRadius = v15; + v17 = atoi(v16); + v18 = v42.pProperties[7]; + v2->pDecorations[v2->uNumDecorations].uColoredLightRed = v17; + v19 = atoi(v18); + v20 = v42.pProperties[8]; + v2->pDecorations[v2->uNumDecorations].uColoredLightGreen = v19; + v21 = atoi(v20); + v22 = v42.pProperties[9]; + v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = v21; + v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v22); + v25 = __OFSUB__(v42.uPropCount, 10); + v23 = v42.uPropCount == 10; + v24 = v42.uPropCount - 10 < 0; + v2->pDecorations[v2->uNumDecorations].uFlags = 0; + if ( !((unsigned __int8)(v24 ^ v25) | v23) ) + { + strcpy(&Dest, v42.pProperties[10]); + memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41)); + for ( j = 0; j < v41.uPropCount; ++j ) + { + v27 = v41.pProperties[j]; + if ( _stricmp(v41.pProperties[j], "NBM") ) + { + if ( _stricmp(v27, "Invisible") ) + { + if ( _stricmp(v27, "FS") ) + { + if ( _stricmp(v27, "FM") ) + { + if ( _stricmp(v27, "FF") ) + { + if ( _stricmp(v27, "Marker") ) + { + if ( _stricmp(v27, "LoopSlow") ) + { + if ( _stricmp(v27, "EmitFire") ) + { + if ( _stricmp(v27, "Dawn") ) + { + if ( !_stricmp(v27, "Dusk") ) + HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 2u; + } + else + { + HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 1u; + } + } + else + { + v35 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; + *(char *)v35 |= 0x80u; + } + } + else + { + v34 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; + *(char *)v34 |= 0x40u; + } + } + else + { + v33 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; + *(char *)v33 |= 0x20u; + } + } + else + { + v32 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; + *(char *)v32 |= 0x10u; + } + } + else + { + v31 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; + *(char *)v31 |= 8u; + } + } + else + { + v30 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; + *(char *)v30 |= 4u; + } + } + else + { + v29 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; + *(char *)v29 |= 2u; + } + } + else + { + v28 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; + *(char *)v28 |= 1u; + } + } + } + ++v2->uNumDecorations; + } + } + fclose(File); + return 1; +} + +//----- (004488B6) -------------------------------------------------------- +unsigned __int16 DecorationList::GetDecorIdByName(const char *pName) +{ + DecorationList *v2; // esi@1 + signed int uID; // edi@2 + signed int v4; // ebx@3 + unsigned __int16 result; // ax@6 + + v2 = this; + if ( pName && (uID = 1, (signed int)this->uNumDecorations > 1) ) + { + v4 = 1; + while ( _stricmp(pName, v2->pDecorations[v4].pName) ) + { + ++uID; + ++v4; + if ( uID >= (signed int)v2->uNumDecorations ) + goto LABEL_6; + } + result = uID; + } + else + { +LABEL_6: + result = 0; + } + return result; +} \ No newline at end of file
--- a/GUIWindow.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/GUIWindow.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -1860,4 +1860,58 @@ } } return pWindow; +} + +//----- (00467FB6) -------------------------------------------------------- +void CreateScrollWindow() + { + unsigned int v0; // eax@1 + char *v1; // ST18_4@3 + unsigned int v2; // eax@3 + GUIWindow a1; // [sp+Ch] [bp-54h]@1 + + memcpy(&a1, pGUIWindow_ScrollWindow, sizeof(a1)); + a1.Hint = 0; + a1.uFrameX = 1; + a1.uFrameY = 1; + a1.uFrameWidth = 468; + v0 = pFontSmallnum->CalcTextHeight(pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], &a1, 0, 0) + + 2 * LOBYTE(pFontCreate->uFontHeight) + + 24; + a1.uFrameHeight = v0; + if ( (signed int)(v0 + a1.uFrameY) > 479 ) + { + v0 = 479 - a1.uFrameY; + a1.uFrameHeight = 479 - a1.uFrameY; + } + a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1; + a1.uFrameW = v0 + a1.uFrameY - 1; + a1.DrawMessageBox(0); + a1.uFrameX += 12; + a1.uFrameWidth -= 24; + a1.uFrameY += 12; + a1.uFrameHeight -= 12; + a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1; + a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; + v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName; + v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu); + sprintf(pTmpBuf.data(), format_4E2D80, v2, v1); + a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u); + a1.DrawText(pFontSmallnum, 1, LOBYTE(pFontCreate->uFontHeight) - 3, 0, pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], 0, 0, 0); +} + +//----- (00467F48) -------------------------------------------------------- +void CreateMsgScrollWindow( signed int mscroll_id ) + { + signed int v1; // esi@1 + + v1 = mscroll_id; + if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 ) + { + if ( mscroll_id <= 782 ) + { + uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE); + pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Scroll, v1 - 700, 0); + } + } } \ No newline at end of file
--- a/Indoor.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/Indoor.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -4638,4 +4638,14 @@ } } } +} + +//----- (0046BDF1) -------------------------------------------------------- +void __cdecl BLV_UpdateUserInputAndOther() +{ + UpdateObjects(); + BLV_ProcessPartyActions(); + UpdateActors_BLV(); + BLV_UpdateDoors(); + check_event_triggers(); } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ObjectList.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -0,0 +1,219 @@ +#include "ObjectList.h" +#include "mm7_data.h" +#include "Sprites.h" +#include "Allocator.h" +#include "FrameTableInc.h" + +//----- (00459064) -------------------------------------------------------- +void ObjectList::InitializeSprites() +{ + for (uint i = 0; i < uNumObjects; ++i) + pSpriteFrameTable->InitializeSprite(pObjects[i].uSpriteID); +} + +//----- (00459090) -------------------------------------------------------- +void ObjectList::ToFile() +{ + ObjectList *v1; // esi@1 + FILE *v2; // eax@1 + FILE *v3; // edi@1 + + v1 = this; + v2 = fopen("data\\dobjlist.bin", "wb"); + v3 = v2; + if ( !v2 ) + Abortf("Unable to save dobjlist.bin!"); + fwrite(v1, 4u, 1u, v2); + fwrite(v1->pObjects, 0x38u, v1->uNumObjects, v3); + fclose(v3); +} + +//----- (004590DC) -------------------------------------------------------- +void ObjectList::FromFile(void *pSerialized) +{ + uNumObjects = *(int *)pSerialized; + pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, 56 * uNumObjects, "Obj Descrip"); + memcpy(pObjects, (char *)pSerialized + 4, 56 * uNumObjects); +} + +//----- (00459123) -------------------------------------------------------- +bool ObjectList::FromFileTxt(const char *Args) +{ + ObjectList *v2; // ebx@1 + __int32 v3; // edi@1 + FILE *v4; // eax@1 + unsigned int v5; // esi@3 + void *v6; // eax@9 + FILE *v7; // ST0C_4@11 + char *i; // eax@11 + unsigned __int16 v9; // ax@14 + const char *v10; // ST20_4@14 + __int16 v11; // ax@14 + const char *v12; // ST1C_4@14 + __int16 v13; // ax@14 + const char *v14; // ST18_4@14 + __int16 v15; // ax@14 + const char *v16; // ST14_4@14 + __int16 v17; // ax@14 + const char *v18; // ST10_4@14 + __int16 v19; // ax@14 + const char *v20; // ST0C_4@14 + int v21; // esi@16 + const char *v22; // edi@16 + int v23; // eax@17 + int v24; // eax@19 + int v25; // eax@21 + int v26; // eax@21 + int v27; // eax@21 + int v28; // eax@23 + int v29; // eax@25 + int v30; // eax@27 + int v31; // eax@29 + const char *v32; // edi@30 + const char *v33; // ST20_4@35 + int v34; // eax@35 + char v35; // al@35 + const char *v36; // ST1C_4@35 + char v37; // al@35 + const char *v38; // ST18_4@35 + FrameTableTxtLine v40; // [sp+8h] [bp-460h]@14 + FrameTableTxtLine v41; // [sp+84h] [bp-3E4h]@12 + char Dest; // [sp+100h] [bp-368h]@14 + char Buf; // [sp+178h] [bp-2F0h]@3 + FrameTableTxtLine v44; // [sp+36Ch] [bp-FCh]@4 + FrameTableTxtLine v45; // [sp+3E8h] [bp-80h]@4 + FILE *File; // [sp+464h] [bp-4h]@1 + unsigned int Argsa; // [sp+470h] [bp+8h]@3 + int Argsb; // [sp+470h] [bp+8h]@15 + + v2 = this; + pAllocator->FreeChunk(this->pObjects); + v3 = 0; + v2->pObjects = 0; + v2->uNumObjects = 0; + v4 = fopen(Args, "r"); + File = v4; + if ( !v4 ) + Abortf("ObjectDescriptionList::load - Unable to open file: %s."); + v5 = 0; + Argsa = 0; + if ( fgets(&Buf, 490, v4) ) + { + do + { + *strchr(&Buf, 10) = 0; + memcpy(&v45, frame_table_txt_parser(&Buf, &v44), sizeof(v45)); + if ( v45.uPropCount && *v45.pProperties[0] != '/' ) + ++Argsa; + } + while ( fgets(&Buf, 490, File) ); + v5 = Argsa; + v3 = 0; + } + v2->uNumObjects = v5; + v6 = pAllocator->AllocNamedChunk(v2->pObjects, 56 * v5, "Obj Descrip"); + v2->pObjects = (ObjectDesc *)v6; + if ( v6 == (void *)v3 ) + Abortf("ObjectDescriptionList::load - Out of Memory!"); + memset(v6, v3, 56 * v2->uNumObjects); + v7 = File; + v2->uNumObjects = v3; + fseek(v7, v3, v3); + for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) + { + *strchr(&Buf, 10) = 0; + memcpy(&v45, frame_table_txt_parser(&Buf, &v41), sizeof(v45)); + if ( v45.uPropCount && *v45.pProperties[0] != 47 ) + { + strcpy(v2->pObjects[v2->uNumObjects].field_0, v45.pProperties[0]); + v9 = pSpriteFrameTable->FastFindSprite((char *)v45.pProperties[1]); + v10 = v45.pProperties[2]; + v2->pObjects[v2->uNumObjects].uSpriteID = v9; + v11 = atoi(v10); + v12 = v45.pProperties[3]; + v2->pObjects[v2->uNumObjects].uObjectID = v11; + v13 = atoi(v12); + v14 = v45.pProperties[4]; + v2->pObjects[v2->uNumObjects].uRadius = v13; + v15 = atoi(v14); + v16 = v45.pProperties[5]; + v2->pObjects[v2->uNumObjects].uHeight = v15; + v17 = atoi(v16); + v18 = v45.pProperties[6]; + v2->pObjects[v2->uNumObjects].uLifetime = v17; + v19 = atoi(v18); + v20 = v45.pProperties[7]; + v2->pObjects[v2->uNumObjects].uSpeed = v19; + strcpy(&Dest, v20); + memcpy(&v44, frame_table_txt_parser(&Dest, &v40), sizeof(v44)); + if ( v45.uPropCount > 7 ) + { + for ( Argsb = 0; Argsb < v44.uPropCount; ++Argsb ) + { + v21 = Argsb; + v22 = v44.pProperties[Argsb]; + if ( !_stricmp(v44.pProperties[Argsb], "NoDraw") ) + { + v23 = (int)&v2->pObjects[v2->uNumObjects].uFlags; + *(char *)v23 |= 1u; + } + if ( !_stricmp(v22, "Lifetime") ) + { + v24 = (int)&v2->pObjects[v2->uNumObjects].uFlags; + *(char *)v24 |= 4u; + } + if ( !_stricmp(v22, "FTLifetime") ) + { + v25 = (int)&v2->pObjects[v2->uNumObjects]; + *(short *)(v25 + 42) = 8 * pSpriteFrameTable->pSpriteSFrames[*(short *)(v25 + 40)].uAnimLength; + v26 = (int)&v2->pObjects[v2->uNumObjects].uFlags; + *(char *)v26 |= 8u; + v27 = (int)&v2->pObjects[v2->uNumObjects].uFlags; + *(char *)v27 |= 4u; + } + if ( !_stricmp(v22, "NoPickup") ) + { + v28 = (int)&v2->pObjects[v2->uNumObjects].uFlags; + *(char *)v28 |= 0x10u; + } + if ( !_stricmp(v22, "NoGravity") ) + { + v29 = (int)&v2->pObjects[v2->uNumObjects].uFlags; + *(char *)v29 |= 0x20u; + } + if ( !_stricmp(v22, "FlagOnIntercept") ) + { + v30 = (int)&v2->pObjects[v2->uNumObjects].uFlags; + *(char *)v30 |= 0x40u; + } + if ( !_stricmp(v22, "Bounce") ) + { + v31 = (int)&v2->pObjects[v2->uNumObjects].uFlags; + *(char *)v31 |= 0x80u; + } + v32 = v45.pProperties[v21]; + if ( !_stricmp(v45.pProperties[v21], "Fire") ) + HIBYTE(v2->pObjects[v2->uNumObjects].uFlags) |= 2u; + if ( !_stricmp(v32, "Lines") ) + HIBYTE(v2->pObjects[v2->uNumObjects].uFlags) |= 4u; + if ( !_stricmp(v44.pProperties[v21], "bits") ) + { + v33 = v44.pProperties[v21 + 1]; + v34 = (int)&v2->pObjects[v2->uNumObjects].uFlags; + *(char *)(v34 + 1) |= 1u; + v35 = atoi(v33); + v36 = v44.pProperties[v21 + 2]; + v2->pObjects[v2->uNumObjects].uParticleTrailColorR = v35; + v37 = atoi(v36); + v38 = v44.pProperties[v21 + 3]; + v2->pObjects[v2->uNumObjects].uParticleTrailColorG = v37; + v2->pObjects[v2->uNumObjects].uParticleTrailColorB = atoi(v38); + } + } + } + ++v2->uNumObjects; + } + } + fclose(File); + return 1; +} \ No newline at end of file
--- a/Outdoor.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/Outdoor.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -37,6 +37,7 @@ #include "MapInfo.h" #include "OutdoorCamera.h" #include "BSPModel.h" +#include "GUIWindow.h" MapStartPoint uLevel_StartingPointType; // weak @@ -3169,4 +3170,40 @@ return false; else return true; +} + +//----- (0046BE0A) -------------------------------------------------------- +void __cdecl ODM_UpdateUserInputAndOther() +{ + bool v0; // eax@5 + char pOut[32]; // [sp+8h] [bp-20h]@5 + + UpdateObjects(); + ODM_ProcessPartyActions(); + if ( pParty->vPosition.x < -22528 + || pParty->vPosition.x > 22528 + || pParty->vPosition.y < -22528 + || pParty->vPosition.y > 22528 ) + { + strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); + v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 32); + if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 ) + { + if ( pParty->vPosition.x < -22528 ) + pParty->vPosition.x = -22528; + if ( pParty->vPosition.x > 22528 ) + pParty->vPosition.x = 22528; + if ( pParty->vPosition.y < -22528 ) + pParty->vPosition.y = -22528; + if ( pParty->vPosition.y > 22528 ) + pParty->vPosition.y = 22528; + } + else + { + pAudioPlayer->StopChannels(-1, -1); + TravelUI_Load(); + } + } + UpdateActors_ODM(); + check_event_triggers(); } \ No newline at end of file
--- a/SaveLoad.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/SaveLoad.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -23,6 +23,8 @@ #include "stru123.h" #include "texts.h" #include "Log.h" +#include "VideoPlayer.h" +#include "Allocator.h" #include "mm7_data.h" @@ -610,4 +612,110 @@ } } _chdir(".."); +} + +//----- (0046086A) -------------------------------------------------------- +void SaveNewGame() +{ + FILE *v3; // eax@7 + void *pSave; // [sp+170h] [bp-8h]@3 + + if ( pVideoPlayer->AnyMovieLoaded() ) + pVideoPlayer->Unload(); + pSave = pAllocator->AllocNamedChunk(0, 1000000, 0); + pNew_LOD->CloseWriteFile(); + remove("data\\new.lod"); + + LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3 + strcpy(this_.LodVersion, "MMVII"); + strcpy(this_.LodDescription, "newmaps for MMVII"); + this_.LODSize = 100; + this_.dword_0000A8 = 0; + + LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3 + a3.dword_000018 = 0; + a3.word_00001E = 0; + strcpy(a3.pFilename, "current"); + pNew_LOD->CreateNewLod(&this_, &a3, "data\\new.lod"); + if (pNew_LOD->LoadFile("data\\new.lod", false)) + { + pNew_LOD->CreateTempFile(); + pNew_LOD->uNumSubDirs = 0; + + LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4 + for (int i = pGames_LOD->uNumSubDirs / 2; i < pGames_LOD->uNumSubDirs; ++i) + { + memcpy(&pDir, &pGames_LOD->pSubIndices[i], sizeof(pDir)); + v3 = pGames_LOD->FindContainer(pGames_LOD->pSubIndices[i].pFilename, 1); + fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3); + pNew_LOD->AppendDirectory(&pDir, pSave); + } + + LOD::Directory save_game_dir; // [sp+12Ch] [bp-4Ch]@9 + strcpy(pSavegameHeader[0].pLocationName, "out01.odm"); + strcpy(save_game_dir.pFilename, "header.bin"); + save_game_dir.uDataSize = sizeof(SavegameHeader); + pNew_LOD->AppendDirectory(&save_game_dir, &pSavegameHeader[0]); + + pNew_LOD->FixDirectoryOffsets(); + pParty->vPrevPosition.y = 0; + pParty->vPrevPosition.x = 12552; + pParty->vPosition.x = 12552; + pParty->vPosition.z = 0; + pParty->uFallStartY = 0; + pParty->sPrevRotationX = 0; + pParty->sRotationX = 0; + pParty->vPrevPosition.z = 1816; + pParty->vPosition.y = 1816; + pParty->sPrevRotationY = 512; + pParty->sRotationY = 512; + SaveGame(1, 1); + } + pAllocator->FreeChunk(pSave); +} + +//----- (0045E26C) -------------------------------------------------------- +void __thiscall SaveScreenshot(const char *pFilename) +{ + const char *v1; // edi@1 + unsigned __int16 *v2; // esi@1 + + v1 = pFilename; + v2 = MakeScreenshot(92, 68); + pRenderer->SavePCXImage(v1, (char *)v2, 92, 68); + free(v2); +} + +//----- (00460706) -------------------------------------------------------- +void TryLoadLevelFromLOD() +{ + FILE *v0; // eax@1 + FILE *v1; // esi@1 + __int32 v2; // edi@2 + char Ext[256]; // [sp+4h] [bp-40Ch]@1 + char Dir[256]; // [sp+104h] [bp-30Ch]@1 + char Filename[256]; // [sp+204h] [bp-20Ch]@1 + char a1[260]; // [sp+304h] [bp-10Ch]@1 + char Drive[4]; // [sp+408h] [bp-8h]@1 + int DstBuf; // [sp+40Ch] [bp-4h]@2 + + strcpy(a1, pCurrentMapName.data()); + _splitpath(a1, Drive, Dir, Filename, Ext); + sprintf(a1, "levels\\%s%s", Filename, ".lod"); + v0 = fopen(a1, "rb"); + v1 = v0; + if ( v0 ) + { + fseek(v0, 0, 2); + v2 = ftell(v1); + rewind(v1); + ptr_6A0D08 = pAllocator->AllocNamedChunk(ptr_6A0D08, v2, "LevelLod"); + fread(ptr_6A0D08, v2, 1u, v1); + fseek(v1, v2 - 6, 0); + DstBuf = 0; + fread(&DstBuf, 4u, 1u, v1); + fread(&_6A0D10_txt_lod_loading__unused, 2u, 1u, v1); + _6A0D0C_txt_lod_loading = (int)((char *)ptr_6A0D08 + DstBuf); + fclose(v1); + } } \ No newline at end of file
--- a/Spells.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/Spells.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -432,4 +432,119 @@ strtok(NULL, "\r"); } - } \ No newline at end of file + } +//----- (0045828B) -------------------------------------------------------- +unsigned int __fastcall GetSpellColor(signed int a1) +{ + unsigned __int16 v1; // dx@3 + unsigned __int16 v2; // cx@6 + unsigned __int16 v4; // [sp-4h] [bp-4h]@3 + + if ( a1 < 1 ) + { + if ( a1 < 12 ) + { + if ( a1 < 23 ) + { + if ( a1 < 34 ) + { + if ( a1 < 45 ) + { + if ( a1 < 56 ) + { + if ( a1 < 67 ) + { + if ( a1 < 78 ) + { + if ( a1 < 89 ) + goto LABEL_31; + goto LABEL_28; + } +LABEL_25: + if ( a1 < 89 ) + { + v4 = 155; + v2 = 255; + goto LABEL_30; + } +LABEL_28: + if ( a1 < 100 ) + { + v4 = 240; + v2 = 192; + goto LABEL_30; + } +LABEL_31: + v4 = 0; + v1 = 0; + goto LABEL_32; + } +LABEL_21: + if ( a1 < 78 ) + { + v4 = 0; + v1 = 128; + goto LABEL_23; + } + goto LABEL_25; + } +LABEL_18: + if ( a1 < 67 ) + { + v4 = 255; + v1 = 15; + v2 = 235; + return TargetColor(v2, v1, v4); + } + goto LABEL_21; + } +LABEL_15: + if ( a1 < 56 ) + { + v2 = 225; + goto LABEL_13; + } + goto LABEL_18; + } +LABEL_11: + if ( a1 < 45 ) + { + v2 = 128; +LABEL_13: + v4 = v2; +LABEL_30: + v1 = v2; + return TargetColor(v2, v1, v4); + } + goto LABEL_15; + } +LABEL_8: + if ( a1 < 34 ) + { + v4 = 255; + v1 = 128; +LABEL_32: + v2 = 0; + return TargetColor(v2, v1, v4); + } + goto LABEL_11; + } + } + else + { + if ( a1 < 12 ) + { + v4 = 0; + v1 = 85; +LABEL_23: + v2 = 255; + return TargetColor(v2, v1, v4); + } + } + if ( a1 >= 23 ) + goto LABEL_8; + v4 = 255; + v1 = 212; + v2 = 150; + return TargetColor(v2, v1, v4); +} \ No newline at end of file
--- a/SpriteObject.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/SpriteObject.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -1087,4 +1087,119 @@ memcpy(&pSpriteObjects[new_obj_pos++], &pSpriteObjects[i],sizeof(SpriteObject)); } uNumSpriteObjects = new_obj_pos; - } \ No newline at end of file + } + +//----- (0046BEF1) -------------------------------------------------------- +void SpriteObject::_46BEF1_apply_spells_aoe() +{ + SpriteObject *v1; // edi@1 + Actor *v2; // esi@2 + __int16 v3; // fps@4 + unsigned __int8 v4; // c0@4 + unsigned __int8 v5; // c3@4 + signed int v6; // [sp+8h] [bp-4h]@1 + + int v7,v8,v9,v10,v11; + + v6 = 0; + v1 = this; + if ( (signed int)uNumActors > 0 ) + { + v2 = pActors.data();//[0].vPosition.y; + do + { + if ( v2->CanAct() ) + { + //UNDEF(v3); + //.text:0046BF26 movsx eax, word ptr [esi-2] + //.text:0046BF2A sub eax, [edi+4] + //.text:0046BF31 mov [ebp+var_8], eax + //.text:0046BF37 fild [ebp+var_8] + // v7 pushed to stack + v7 = v2->vPosition.x - this->vPosition.x; + + //.text:0046BF2D movsx ecx, word ptr [esi+2] + v8 = v2->vPosition.z; + + //.text:0046BF34 movsx eax, word ptr [esi] + //.text:0046BF3A sub eax, [edi+8] + //.text:0046BF3D mov [ebp+var_8], eax + //.text:0046BF44 fild [ebp+var_8] + // v9 pushed to stack + v9 = v2->vPosition.y - this->vPosition.y; + + //.text:0046BF40 movsx eax, word ptr [esi-6] + //.text:0046BF47 sar eax, 1 + //.text:0046BF49 add eax, ecx + //.text:0046BF4B sub eax, [edi+0Ch] + //.text:0046BF4E mov [ebp+var_8], eax + //.text:0046BF51 fild [ebp+var_8] + //.text:0046BF58 fld st + // v10 pushed to stack, two times + v10 = v2->uActorHeight / 2 + v8 - this->vVelocity.y; + + //.text:0046BF54 movsx eax, word ptr [esi-8] + //.text:0046BF5A add eax, 100h + //.text:0046BF63 mov ecx, eax + v11 = this->vVelocity.x; + + //.text:0046BF5F fmul st, st(1) + // stack: v10*v10, v10, v9, v7 + //.text:0046BF61 fld st(2) + // stack: v7, v10*v10, v10, v9, v7 + + + //.text:0046BF65 fmul st, st(3) + // stack: v7*v9, v10*v10, v10, v9, v7 + + //.text:0046BF67 imul ecx, eax + v11 = v11 * v11; + + //.text:0046BF6A faddp st(1), st + // stack: v10*v10+v7*v9, v10, v9, v7 + //.text:0046BF6C fld st(3) + // stack: v7, v10*v10+v7*v9, v10, v9, v7 + //.text:0046BF6E fmul st, st(4) + // stack: v7*v7, v10*v10+v7*v9, v10, v9, v7 + //.text:0046BF70 faddp st(1), st + // stack: v10*v10+v7*v9+v7*v7, v10, v9, v7 + + //.text:0046BF72 mov [ebp+var_8], ecx + //.text:0046BF75 fild [ebp+var_8] + // v11 pushed to stack + + //.text:0046BF78 fcompp + // if ( v11 > v10*v10+v7*v9+v7*v7 ) + // stack: v10, v9, v7 + + //.text:0046BF7A fstp st + // stack: v9, v7 + + //.text:0046BF7C fnstsw ax + //.text:0046BF7E fstp st + // stack: v7 + + //.text:0046BF80 test ah, 41h + //.text:0046BF83 fstp st + //.text:0046BF85 jnz short loc_46BFDD + + if ( v11 >= v10*v10+v7*v9+v7*v7 ) + { + if ( stru_50C198.GetMagicalResistance(v2, 0xAu) ) + { + v2->pActorBuffs[v1->spell_id].Apply( + pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->spell_level << 7) * 0.033333335), + v1->spell_skill, + 4u, + 0, + 0); + HIWORD(v2->uAttributes) |= 8u; + } + } + } + ++v6; + ++v2; + } + while ( v6 < (signed int)uNumActors ); + } +} \ No newline at end of file
--- a/Texture.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/Texture.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -1636,4 +1636,121 @@ field_18 = 0; field_20 = 0; field_22 = 0; +} +//----- (0044E1EC) -------------------------------------------------------- +int TextureFrameTable::FromFileTxt(const char *Args) +{ + TextureFrameTable *v2; // ebx@1 + FILE *v3; // eax@1 + int v4; // esi@3 + const void *v5; // ST0C_4@10 + void *v6; // eax@10 + FILE *v7; // ST0C_4@12 + char *i; // eax@12 + signed int v9; // esi@15 + int v10; // eax@17 + int v11; // edx@22 + int v12; // ecx@23 + int v13; // eax@24 + signed int j; // eax@27 + TextureFrame *v15; // edx@28 + int v16; // esi@28 + int k; // ecx@29 + char Buf; // [sp+Ch] [bp-2F8h]@3 + FrameTableTxtLine v20; // [sp+200h] [bp-104h]@4 + int v21; // [sp+27Ch] [bp-88h]@4 + char *Str1; // [sp+280h] [bp-84h]@5 + char *Str; // [sp+284h] [bp-80h]@15 + int v24; // [sp+2F8h] [bp-Ch]@3 + int v25; // [sp+2FCh] [bp-8h]@3 + FILE *File; // [sp+300h] [bp-4h]@1 + int Argsa; // [sp+30Ch] [bp+8h]@28 + + v2 = this; + v3 = fopen(Args, "r"); + File = v3; + if ( !v3 ) + Abortf("CTextureFrameTable::load - Unable to open file: %s.", Args); + v4 = 0; + v24 = 0; + v25 = 1; + if ( fgets(&Buf, 490, v3) ) + { + do + { + *strchr(&Buf, 10) = 0; + memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu); + if ( v21 && *Str1 != 47 ) + { + if ( v21 < 2 ) + Abortf("CTextureFrameTable::load, too few arguments, %s line %i.", Args, v25); + ++v24; + } + ++v25; + } + while ( fgets(&Buf, 490, File) ); + v4 = v24; + } + v5 = v2->pTextures; + v2->sNumTextures = v4; + v6 = pAllocator->AllocNamedChunk(v5, 20 * v4, "Txt Frames"); + v2->pTextures = (TextureFrame *)v6; + if ( !v6 ) + Abortf("CTextureFrameTable::load - Out of Memory!"); + v7 = File; + v2->sNumTextures = 0; + fseek(v7, 0, 0); + for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) + { + *strchr(&Buf, 10) = 0; + memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu); + if ( v21 && *Str1 != 47 ) + { + strcpy(v2->pTextures[v2->sNumTextures].pTextureName, Str1); + v2->pTextures[v2->sNumTextures].uAnimTime = atoi(Str); + v9 = 2; + for ( v2->pTextures[v2->sNumTextures].uFlags = 0; v9 < v21; ++v9 ) + { + if ( !_stricmp((&Str1)[4 * v9], "New") ) + { + v10 = (int)&v2->pTextures[v2->sNumTextures].uFlags; + *(char *)v10 |= 2u; + } + } + ++v2->sNumTextures; + } + } + fclose(File); + v11 = 0; + if ( (signed int)(v2->sNumTextures - 1) > 0 ) + { + v12 = 0; + do + { + v13 = (int)&v2->pTextures[v12]; + if ( !(*(char *)(v13 + 38) & 2) ) + *(char *)(v13 + 18) |= 1u; + ++v11; + ++v12; + } + while ( v11 < (signed int)(v2->sNumTextures - 1) ); + } + for ( j = 0; j < (signed int)v2->sNumTextures; *(short *)(Argsa + 16) = v16 ) + { + v15 = v2->pTextures; + Argsa = (int)&v15[j]; + v16 = *(short *)(Argsa + 14); + if ( *(char *)(Argsa + 18) & 1 ) + { + ++j; + for ( k = (int)&v15[j]; *(char *)(k + 18) & 1; k += 20 ) + { + v16 += *(short *)(k + 14); + ++j; + } + LOWORD(v16) = v15[j].uAnimTime + v16; + } + ++j; + } + return 1; } \ No newline at end of file
--- a/UIHouses.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/UIHouses.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -6255,4 +6255,330 @@ while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem ); } return; +} +//----- (004BC8D5) -------------------------------------------------------- +void SpellBookGenerator()//for GuildDialogs +{ + int pItemNum; // esi@1 + int v4; // esi@7 + + for( int i = 0; i < 12; ++i ) + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 ) + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 ) + pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345; + else + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 ) + v4 = rand() % 4; + else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 ) + v4 = rand() % 3 + 4; + else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 ) + v4 = rand() % 2 + 7; + if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 ) + pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400; + } + } + if ( pItemNum == 487 ) + { + if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) + pItemNum = 486; + } + ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; + item_spellbook->Reset(); + pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum; + pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified(); + ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE); + } + return; +} +//----- (004BDB56) -------------------------------------------------------- +void __cdecl UIShop_Buy_Identify_Repair() +{ + int v8; // eax@15 + unsigned int pItemID; // esi@20 + ItemGen *item; // esi@21 + unsigned int v15; // eax@33 + POINT *pCursorPos; // esi@37 + int v18; // ecx@37 + float pPriceMultiplier; // ST1C_4@38 + int taken_item; // eax@40 + ItemGen *bought_item; // esi@51 + int party_reputation; // eax@55 + int v39; // eax@63 + int v42; // esi@74 + signed int v43; // ebx@74 + unsigned __int16 *pSkill; // esi@77 + int v55; // [sp+0h] [bp-B4h]@26 + POINT cursor; // [sp+40h] [bp-74h]@37 + int a6; // [sp+98h] [bp-1Ch]@57 + int a3; // [sp+9Ch] [bp-18h]@53 + unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 + unsigned int v79; // [sp+A8h] [bp-Ch]@9 + int uPriceItemService; // [sp+ACh] [bp-8h]@12 + + if ( pCurrentScreen == SCREEN_E ) + { + OnInventoryLeftClick(); + return; + } + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; + } + + switch(dialog_menu_id) + { + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; + OnInventoryLeftClick(); + break; + } + case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: + { + pCursorPos = pMouse->GetCursorPos(&cursor); + v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&cursor)->y]] & 0xFFFF; + if ( !v18 ) + return; + bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); + pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier); + GetAsyncKeyState(VK_CONTROL); + if ( pParty->uNumGold < uPriceItemService ) + { + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); + return; + } + taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); + if ( taken_item ) + { + bought_item->SetIdentified(); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[taken_item - 1], bought_item, 0x24u); + dword_F8B1E4 = 1; + Party::TakeGold(uPriceItemService); + viewparams->bRedrawGameUI = 1; + bought_item->Reset(); + pRenderer->ClearZBuffer(0, 479); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!" + break; + } + case HOUSE_DIALOGUE_SHOP_SELL: + { + v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&cursor)->x <= 13 + || pMouse->GetCursorPos(&cursor)->x >= 462 + || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) + return; + if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItems[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) + { + dword_F8B1E4 = 1; + pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); + viewparams->bRedrawGameUI = 1; + pRenderer->ClearZBuffer(0, 479); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0); + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + break; + } + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + { + pMouse->GetCursorPos(&cursor); + v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); + if (cursor.x > 13 && cursor.x < 462) + { + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); + if ( pItemID ) + { + uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); + item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; + if ( !(item->uAttributes & 1) ) + { + if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) + { + if ( pParty->uNumGold >= uPriceItemService ) + { + dword_F8B1E4 = 1; + Party::TakeGold(uPriceItemService); + item->uAttributes |= 1; + pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2); + return; + } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); + return; + } + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); + return; + } + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); + return; + } + } + break; + } + case HOUSE_DIALOGUE_SHOP_REPAIR: + { + v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&cursor)->x > 13 ) + { + if ( pMouse->GetCursorPos(&cursor)->x < 462 ) + { + pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); + if ( pItemID ) + { + item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; + pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; + uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); + if ( item->uAttributes & 2 ) + { + if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) + { + if ( pParty->uNumGold >= uPriceItemService ) + { + dword_F8B1E4 = 1; + Party::TakeGold(uPriceItemService); + v8 = item->uAttributes; + LOBYTE(v8) = v8 & 0xFD; + item->uAttributes = v8 | 1; + pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2); + return; + } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); + return; + } + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); + return; + } + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); + return; + } + } + } + break; + } + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: + { + pCursorPos = pMouse->GetCursorPos(&cursor); + v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF; + if ( !v18 ) + return; + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) + bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; + else + bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; + uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); + uNumSeconds = 0; + a3 = 0; + if ( pMapStats->GetMapInfo(pCurrentMapName.data()) ) + a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]._steal_perm; + party_reputation = GetPartyReputation(); + if (pPlayers[uActiveCharacter]->CanSteal()) + { + if ( GetAsyncKeyState(VK_CONTROL) ) + { + uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); + if ( !uNumSeconds ) + { + sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); + return; + } + } + } + if ( pParty->uNumGold < uPriceItemService ) + { + if ( uNumSeconds != 2 ) + { + if ( uNumSeconds != 1 ) + { + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" + return; + } + } + } + v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); + if ( v39 ) + { + bought_item->SetIdentified(); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1], bought_item, sizeof(ItemGen)); + if ( pPlayers[uActiveCharacter]->CanSteal() ) + { + if ( GetAsyncKeyState(VK_CONTROL) ) + { + if ( uNumSeconds == 1 || uNumSeconds == 2 ) + { + pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1].SetStolen(); + sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); + viewparams->bRedrawGameUI = 1; + bought_item->Reset(); + pRenderer->ClearZBuffer(0, 479); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); + return; + } + } + } + dword_F8B1E4 = 1; + Party::TakeGold(uPriceItemService); + viewparams->bRedrawGameUI = 1; + bought_item->Reset(); + pRenderer->ClearZBuffer(0, 479); + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" + break; + } + default:// if click video screen in shop + { + __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum + if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) + { + v42 = dialog_menu_id - 36; + //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); + v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( uPriceItemService < v43 / 3 ) + uPriceItemService = v43 / 3; + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] ) + { + pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42]; + if ( !*pSkill ) + { + if ( pParty->uNumGold < uPriceItemService ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" + if ( in_current_building_type == BildingType_Training ) + v55 = 4; + else + v55 = 2; + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55); + return; + } + Party::TakeGold(uPriceItemService); + dword_F8B1E4 = 1; + *pSkill = 1; + pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0); + return; + } + } + } + break; + } + } } \ No newline at end of file
--- a/mm7_1.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/mm7_1.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -1488,12 +1488,12 @@ //----- (00423B5D) -------------------------------------------------------- int __fastcall sub_423B5D(unsigned int uFaceID) { - BLVFace *v1; // ebx@1 - Vec3_short_ *v2; // esi@1 - int v3; // ST28_4@1 - __int16 v4; // ST2C_2@1 + BLVFace *pFace; // ebx@1 + //Vec3_short_ *v2; // esi@1 + //int v3; // ST28_4@1 + //__int16 v4; // ST2C_2@1 signed int v5; // esi@1 - Vec3_short_ *v6; // eax@4 + //Vec3_short_ *v6; // eax@4 signed int v7; // edi@5 signed int v8; // eax@5 signed int v9; // ecx@10 @@ -1558,7 +1558,7 @@ int v69; // [sp+14h] [bp-14h]@54 int v70; // [sp+14h] [bp-14h]@64 signed int v71; // [sp+14h] [bp-14h]@75 - IndoorCameraD3D *_this; // [sp+18h] [bp-10h]@1 + //IndoorCameraD3D *_this; // [sp+18h] [bp-10h]@1 bool thisa; // [sp+18h] [bp-10h]@9 int thisb; // [sp+18h] [bp-10h]@12 int thisc; // [sp+18h] [bp-10h]@20 @@ -1579,38 +1579,34 @@ signed int v90; // [sp+24h] [bp-4h]@51 signed int v91; // [sp+24h] [bp-4h]@61 - v1 = &pIndoor->pFaces[uFaceID]; - _this = pGame->pIndoorCameraD3D; - v2 = &pIndoor->pVertices[*v1->pVertexIDs]; - v3 = *(_DWORD *)&v2->x; - v4 = v2->z; + pFace = &pIndoor->pFaces[uFaceID]; + //_this = pGame->pIndoorCameraD3D; + //v2 = &pIndoor->pVertices[pFace->pVertexIDs[0]]; + //v3 = *(_DWORD *)&pIndoor->pVertices[pFace->pVertexIDs[0]].x; + //v4 = pIndoor->pVertices[pFace->pVertexIDs[0]].z; v5 = 0; - if ( v1->pFacePlane_old.vNormal.x * ((signed __int16)v3 - pBLVRenderParams->vPartyPos.x) - + v1->pFacePlane_old.vNormal.y * (SHIWORD(v3) - pBLVRenderParams->vPartyPos.y) - + v1->pFacePlane_old.vNormal.z * (v4 - pBLVRenderParams->vPartyPos.z) < 0 ) + if ( pFace->pFacePlane_old.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x) + + pFace->pFacePlane_old.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) + + pFace->pFacePlane_old.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) { stru_50B700.field_0 = 1; } else { stru_50B700.field_0 = 0; - if ( !(v1->uAttributes & 1) ) + if ( !(pFace->uAttributes & 1) ) return 0; } - v66 = v1->uNumVertices; - if ( (signed int)v1->uNumVertices > 0 ) + v66 = pFace->uNumVertices; + if ( (signed int)pFace->uNumVertices > 0 ) { do { - v6 = &pIndoor->pVertices[v1->pVertexIDs[v5]]; - pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( - v6->x, - v6->y, - v6->z, - &stru_50B700._view_transformed_xs[v5 + 3], - &stru_50B700._view_transformed_zs[v5 + 3], - &stru_50B700._view_transformed_ys[v5 + 3], - 0); + //v6 = &pIndoor->pVertices[pFace->pVertexIDs[v5]]; + pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(pIndoor->pVertices[pFace->pVertexIDs[v5]].x, + pIndoor->pVertices[pFace->pVertexIDs[v5]].y, pIndoor->pVertices[pFace->pVertexIDs[v5]].z, + &stru_50B700._view_transformed_xs[v5 + 3], &stru_50B700._view_transformed_zs[v5 + 3], + &stru_50B700._view_transformed_ys[v5 + 3], 0); ++v5; } while ( v5 < v66 );
--- a/mm7_2.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/mm7_2.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -67,6 +67,7 @@ #include "texts.h" #include "MM7.h" #include "Lights.h" +#include "Arcomage.h" //----- (004BB756) -------------------------------------------------------- signed int __fastcall sub_4BB756(signed int a1) @@ -459,83 +460,7 @@ } // F8B1B4: using guessed type int dword_F8B1B4; -//----- (004BBF61) -------------------------------------------------------- -void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z) -{ - size_t v4; // esi@1 - int monster_id; // edi@1 - __int16 v6; // ax@4 - Actor *v7; // esi@5 - int v8; // eax@5 - MonsterInfo *v9; // edi@5 - MonsterDesc *v10; // ebx@5 - unsigned __int16 *v11; // ebx@5 - int v12; // ebx@7 - int v13; // eax@8 - __int16 x_; // [sp+8h] [bp-Ch]@1 - __int16 v15; // [sp+Ch] [bp-8h]@1 - __int16 v16; // [sp+10h] [bp-4h]@3 - signed int ya; // [sp+1Ch] [bp+8h]@5 - - v4 = uNumActors; - monster_id = a1; - x_ = x; - v15 = a1; - if ( (signed int)uNumActors < 500 - && ((signed int)pAllocator->uBigBufferSizeAligned >> 10) - ((signed int)pAllocator->uNextFreeOffsetInBigBuffer >> 10) >= 2000 ) - { - v16 = 0; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - v6 = pIndoor->GetSector(x, y, z); - v4 = uNumActors; - v16 = v6; - } - v7 = &pActors[v4]; - v7->Reset(); - v8 = monster_id; - v9 = &pMonsterStats->pInfos[monster_id]; - v10 = &pMonsterList->pMonsters[v8 - 1]; - strcpy(v7->pActorName, v9->pName); - v7->sCurrentHP = LOWORD(v9->uHP); - memcpy(&v7->pMonsterInfo, v9, 0x58u); - v7->word_000086_some_monster_id = v15; - v7->uActorRadius = v10->uMonsterRadius; - v7->uActorHeight = v10->uMonsterHeight; - v7->uMovementSpeed = v10->uMovementSpeed; - v7->vInitialPosition.x = x_; - v7->vPosition.x = x_; - BYTE2(v7->uAttributes) |= 8u; - v7->pMonsterInfo.uTreasureType = 0; - v7->pMonsterInfo.uTreasureLevel = 0; - v7->pMonsterInfo.uTreasureDiceSides = 0; - v7->pMonsterInfo.uTreasureDiceRolls = 0; - v7->pMonsterInfo.uTreasureDropChance = 0; - v7->vInitialPosition.y = y; - v7->vPosition.y = y; - v7->vInitialPosition.z = z; - v7->vPosition.z = z; - v7->uTetherDistance = 256; - v7->uSectorID = v16; - v7->uGroup = 1; - v7->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; - v7->PrepareSprites(0); - v11 = v10->pSoundSampleIDs; - ya = 4; - do - { - pSoundList->LoadSound((signed __int16)*v11, 0); - ++v11; - --ya; - } - while ( ya ); - v12 = 0; - do - LOWORD(v13) = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v9->uSpell1ID], 1u); - while ( v13 ); - ++uNumActors; - } -} + // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; //----- (004BC109) -------------------------------------------------------- @@ -749,44 +674,6 @@ pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); } -//----- (004BC8D5) -------------------------------------------------------- -void SpellBookGenerator()//for GuildDialogs -{ - int pItemNum; // esi@1 - int v4; // esi@7 - - for( int i = 0; i < 12; ++i ) - { - if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 ) - { - if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 ) - pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345; - else - { - if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 ) - v4 = rand() % 4; - else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 ) - v4 = rand() % 3 + 4; - else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 ) - v4 = rand() % 2 + 7; - if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 ) - pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400; - } - } - if ( pItemNum == 487 ) - { - if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) - pItemNum = 486; - } - ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; - item_spellbook->Reset(); - pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum; - pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified(); - ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE); - } - return; -} - //----- (004BCA33) -------------------------------------------------------- void UI_CreateEndConversationButton() { @@ -896,295 +783,6 @@ return 0; } -//----- (004BDB56) -------------------------------------------------------- -void __cdecl UIShop_Buy_Identify_Repair() -{ - int v8; // eax@15 - unsigned int pItemID; // esi@20 - ItemGen *item; // esi@21 - unsigned int v15; // eax@33 - POINT *pCursorPos; // esi@37 - int v18; // ecx@37 - float pPriceMultiplier; // ST1C_4@38 - int taken_item; // eax@40 - ItemGen *bought_item; // esi@51 - int party_reputation; // eax@55 - int v39; // eax@63 - int v42; // esi@74 - signed int v43; // ebx@74 - unsigned __int16 *pSkill; // esi@77 - int v55; // [sp+0h] [bp-B4h]@26 - POINT cursor; // [sp+40h] [bp-74h]@37 - int a6; // [sp+98h] [bp-1Ch]@57 - int a3; // [sp+9Ch] [bp-18h]@53 - unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 - unsigned int v79; // [sp+A8h] [bp-Ch]@9 - int uPriceItemService; // [sp+ACh] [bp-8h]@12 - - if ( pCurrentScreen == SCREEN_E ) - { - OnInventoryLeftClick(); - return; - } - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; - } - - switch(dialog_menu_id) - { - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: - { - pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - OnInventoryLeftClick(); - break; - } - case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: - { - pCursorPos = pMouse->GetCursorPos(&cursor); - v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&cursor)->y]] & 0xFFFF; - if ( !v18 ) - return; - bought_item = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)window_SpeakInHouse->ptr_1C)); - pPriceMultiplier = p2DEvents[(signed int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), pPriceMultiplier); - GetAsyncKeyState(VK_CONTROL); - if ( pParty->uNumGold < uPriceItemService ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); - return; - } - taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); - if ( taken_item ) - { - bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[taken_item - 1], bought_item, 0x24u); - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - viewparams->bRedrawGameUI = 1; - bought_item->Reset(); - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 5); // "Pack is Full!" - break; - } - case HOUSE_DIALOGUE_SHOP_SELL: - { - v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&cursor)->x <= 13 - || pMouse->GetCursorPos(&cursor)->x >= 462 - || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) - return; - if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItems[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) - { - dword_F8B1E4 = 1; - pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); - viewparams->bRedrawGameUI = 1; - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0); - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - break; - } - case HOUSE_DIALOGUE_SHOP_IDENTIFY: - { - pMouse->GetCursorPos(&cursor); - v79 = ((cursor.x - 14) >> 5) + 14 * ((cursor.y - 17) >> 5); - if (cursor.x > 13 && cursor.x < 462) - { - pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); - if ( pItemID ) - { - uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); - item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; - if ( !(item->uAttributes & 1) ) - { - if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) - { - if ( pParty->uNumGold >= uPriceItemService ) - { - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - item->uAttributes |= 1; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[569], 2); - return; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - return; - } - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); - return; - } - } - break; - } - case HOUSE_DIALOGUE_SHOP_REPAIR: - { - v79 = ((pMouse->GetCursorPos(&cursor)->x - 14) >> 5) + 14 * ((pMouse->GetCursorPos(&cursor)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&cursor)->x > 13 ) - { - if ( pMouse->GetCursorPos(&cursor)->x < 462 ) - { - pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); - if ( pItemID ) - { - item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; - pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; - uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); - if ( item->uAttributes & 2 ) - { - if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) - { - if ( pParty->uNumGold >= uPriceItemService ) - { - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - v8 = item->uAttributes; - LOBYTE(v8) = v8 & 0xFD; - item->uAttributes = v8 | 1; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[570], 2); - return; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - return; - } - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0); - return; - } - } - } - break; - } - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pCursorPos = pMouse->GetCursorPos(&cursor); - v18 = pRenderer->pActiveZBuffer[pCursorPos->x + pSRZBufferLineOffsets[pCursorPos->y]] & 0xFFFF; - if ( !v18 ) - return; - if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) - bought_item = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1]; - else - bought_item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v18 - 1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; - uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); - uNumSeconds = 0; - a3 = 0; - if ( pMapStats->GetMapInfo(pCurrentMapName.data()) ) - a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]._steal_perm; - party_reputation = GetPartyReputation(); - if (pPlayers[uActiveCharacter]->CanSteal()) - { - if ( GetAsyncKeyState(VK_CONTROL) ) - { - uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6); - if ( !uNumSeconds ) - { - sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); - return; - } - } - } - if ( pParty->uNumGold < uPriceItemService ) - { - if ( uNumSeconds != 2 ) - { - if ( uNumSeconds != 1 ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - return; - } - } - } - v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID); - if ( v39 ) - { - bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1], bought_item, sizeof(ItemGen)); - if ( pPlayers[uActiveCharacter]->CanSteal() ) - { - if ( GetAsyncKeyState(VK_CONTROL) ) - { - if ( uNumSeconds == 1 || uNumSeconds == 2 ) - { - pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1].SetStolen(); - sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); - viewparams->bRedrawGameUI = 1; - bought_item->Reset(); - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); - return; - } - } - } - dword_F8B1E4 = 1; - Party::TakeGold(uPriceItemService); - viewparams->bRedrawGameUI = 1; - bought_item->Reset(); - pRenderer->ClearZBuffer(0, 479); - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0); - return; - } - pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!" - break; - } - default:// if click video screen in shop - { - __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum - if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) - { - v42 = dialog_menu_id - 36; - //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - uPriceItemService = v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( uPriceItemService < v43 / 3 ) - uPriceItemService = v43 / 3; - if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v42] ) - { - pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42]; - if ( !*pSkill ) - { - if ( pParty->uNumGold < uPriceItemService ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" - if ( in_current_building_type == BildingType_Training ) - v55 = 4; - else - v55 = 2; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v55); - return; - } - Party::TakeGold(uPriceItemService); - dword_F8B1E4 = 1; - *pSkill = 1; - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0); - return; - } - } - } - break; - } - } -} //----- (004BE386) -------------------------------------------------------- void __fastcall log_error(const char *pMessage) { @@ -2290,124 +1888,6 @@ return result; } -//----- (0044E1EC) -------------------------------------------------------- -int TextureFrameTable::FromFileTxt(const char *Args) -{ - TextureFrameTable *v2; // ebx@1 - FILE *v3; // eax@1 - int v4; // esi@3 - const void *v5; // ST0C_4@10 - void *v6; // eax@10 - FILE *v7; // ST0C_4@12 - char *i; // eax@12 - signed int v9; // esi@15 - int v10; // eax@17 - int v11; // edx@22 - int v12; // ecx@23 - int v13; // eax@24 - signed int j; // eax@27 - TextureFrame *v15; // edx@28 - int v16; // esi@28 - int k; // ecx@29 - char Buf; // [sp+Ch] [bp-2F8h]@3 - FrameTableTxtLine v20; // [sp+200h] [bp-104h]@4 - int v21; // [sp+27Ch] [bp-88h]@4 - char *Str1; // [sp+280h] [bp-84h]@5 - char *Str; // [sp+284h] [bp-80h]@15 - int v24; // [sp+2F8h] [bp-Ch]@3 - int v25; // [sp+2FCh] [bp-8h]@3 - FILE *File; // [sp+300h] [bp-4h]@1 - int Argsa; // [sp+30Ch] [bp+8h]@28 - - v2 = this; - v3 = fopen(Args, "r"); - File = v3; - if ( !v3 ) - Abortf("CTextureFrameTable::load - Unable to open file: %s.", Args); - v4 = 0; - v24 = 0; - v25 = 1; - if ( fgets(&Buf, 490, v3) ) - { - do - { - *strchr(&Buf, 10) = 0; - memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu); - if ( v21 && *Str1 != 47 ) - { - if ( v21 < 2 ) - Abortf("CTextureFrameTable::load, too few arguments, %s line %i.", Args, v25); - ++v24; - } - ++v25; - } - while ( fgets(&Buf, 490, File) ); - v4 = v24; - } - v5 = v2->pTextures; - v2->sNumTextures = v4; - v6 = pAllocator->AllocNamedChunk(v5, 20 * v4, "Txt Frames"); - v2->pTextures = (TextureFrame *)v6; - if ( !v6 ) - Abortf("CTextureFrameTable::load - Out of Memory!"); - v7 = File; - v2->sNumTextures = 0; - fseek(v7, 0, 0); - for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) - { - *strchr(&Buf, 10) = 0; - memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu); - if ( v21 && *Str1 != 47 ) - { - strcpy(v2->pTextures[v2->sNumTextures].pTextureName, Str1); - v2->pTextures[v2->sNumTextures].uAnimTime = atoi(Str); - v9 = 2; - for ( v2->pTextures[v2->sNumTextures].uFlags = 0; v9 < v21; ++v9 ) - { - if ( !_stricmp((&Str1)[4 * v9], "New") ) - { - v10 = (int)&v2->pTextures[v2->sNumTextures].uFlags; - *(char *)v10 |= 2u; - } - } - ++v2->sNumTextures; - } - } - fclose(File); - v11 = 0; - if ( (signed int)(v2->sNumTextures - 1) > 0 ) - { - v12 = 0; - do - { - v13 = (int)&v2->pTextures[v12]; - if ( !(*(char *)(v13 + 38) & 2) ) - *(char *)(v13 + 18) |= 1u; - ++v11; - ++v12; - } - while ( v11 < (signed int)(v2->sNumTextures - 1) ); - } - for ( j = 0; j < (signed int)v2->sNumTextures; *(short *)(Argsa + 16) = v16 ) - { - v15 = v2->pTextures; - Argsa = (int)&v15[j]; - v16 = *(short *)(Argsa + 14); - if ( *(char *)(Argsa + 18) & 1 ) - { - ++j; - for ( k = (int)&v15[j]; *(char *)(k + 18) & 1; k += 20 ) - { - v16 += *(short *)(k + 14); - ++j; - } - LOWORD(v16) = v15[j].uAnimTime + v16; - } - ++j; - } - return 1; -} - //----- (0044F57C) -------------------------------------------------------- void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5) { @@ -3324,62 +2804,6 @@ } } -//----- (00450B0A) -------------------------------------------------------- -bool __fastcall SpawnActor(unsigned int uMonsterID) -{ - unsigned int v1; // ebx@1 - bool result; // eax@2 - MonsterDesc *v3; // esi@5 - MonsterInfo *v4; // edi@5 - Vec3_int_ v5; // ST08_12@5 - unsigned int v6; // ecx@5 - Actor *v7; // eax@7 - Actor actor; // [sp+4h] [bp-350h]@5 - Vec3_int_ pOut; // [sp+348h] [bp-Ch]@5 - - v1 = uMonsterID; - if ( uNumActors == 499 ) - { - result = 0; - } - else - { - if ( (signed int)uMonsterID >= (signed int)pMonsterList->uNumMonsters ) - v1 = 0; - v3 = &pMonsterList->pMonsters[v1]; - v4 = &pMonsterStats->pInfos[v1 + 1]; - memset(&actor, 0, 0x344u); - strcpy(actor.pActorName, v4->pName); - actor.sCurrentHP = LOWORD(v4->uHP); - memcpy(&actor.pMonsterInfo, &pMonsterStats->pInfos[v1 + 1], 0x58u); - actor.word_000086_some_monster_id = v1 + 1; - actor.uActorRadius = v3->uMonsterRadius; - actor.uActorHeight = v3->uMonsterHeight; - actor.uMovementSpeed = v3->uMovementSpeed; - v5 = pParty->vPosition; - Vec3_int_::Rotate(200, pParty->sRotationY, 0, v5, &pOut.x, &pOut.z, &pOut.y); - actor.vInitialPosition.x = pOut.x; - actor.vPosition.x = pOut.x; - actor.uTetherDistance = 256; - actor.vInitialPosition.y = LOWORD(pOut.z); - actor.vPosition.y = LOWORD(pOut.z); - actor.vInitialPosition.z = LOWORD(pOut.y); - actor.vPosition.z = LOWORD(pOut.y); - pSprites_LOD->DeleteSomeSprites(); - pPaletteManager->ResetNonTestLocked(); - v6 = uNumActors - 1; - if ( dword_5C6DF8 == 1 ) - { - dword_5C6DF8 = 0; - v6 = uNumActors++; - } - v7 = &pActors[v6]; - memcpy(v7, &actor, 0x344u); - v7->PrepareSprites(1); - result = 1; - } - return result; -} // 5C6DF8: using guessed type int dword_5C6DF8; //----- (00450DA3) -------------------------------------------------------- @@ -4311,122 +3735,6 @@ } } -//----- (0045828B) -------------------------------------------------------- -unsigned int __fastcall GetSpellColor(signed int a1) -{ - unsigned __int16 v1; // dx@3 - unsigned __int16 v2; // cx@6 - unsigned __int16 v4; // [sp-4h] [bp-4h]@3 - - if ( a1 < 1 ) - { - if ( a1 < 12 ) - { - if ( a1 < 23 ) - { - if ( a1 < 34 ) - { - if ( a1 < 45 ) - { - if ( a1 < 56 ) - { - if ( a1 < 67 ) - { - if ( a1 < 78 ) - { - if ( a1 < 89 ) - goto LABEL_31; - goto LABEL_28; - } -LABEL_25: - if ( a1 < 89 ) - { - v4 = 155; - v2 = 255; - goto LABEL_30; - } -LABEL_28: - if ( a1 < 100 ) - { - v4 = 240; - v2 = 192; - goto LABEL_30; - } -LABEL_31: - v4 = 0; - v1 = 0; - goto LABEL_32; - } -LABEL_21: - if ( a1 < 78 ) - { - v4 = 0; - v1 = 128; - goto LABEL_23; - } - goto LABEL_25; - } -LABEL_18: - if ( a1 < 67 ) - { - v4 = 255; - v1 = 15; - v2 = 235; - return TargetColor(v2, v1, v4); - } - goto LABEL_21; - } -LABEL_15: - if ( a1 < 56 ) - { - v2 = 225; - goto LABEL_13; - } - goto LABEL_18; - } -LABEL_11: - if ( a1 < 45 ) - { - v2 = 128; -LABEL_13: - v4 = v2; -LABEL_30: - v1 = v2; - return TargetColor(v2, v1, v4); - } - goto LABEL_15; - } -LABEL_8: - if ( a1 < 34 ) - { - v4 = 255; - v1 = 128; -LABEL_32: - v2 = 0; - return TargetColor(v2, v1, v4); - } - goto LABEL_11; - } - } - else - { - if ( a1 < 12 ) - { - v4 = 0; - v1 = 85; -LABEL_23: - v2 = 255; - return TargetColor(v2, v1, v4); - } - } - if ( a1 >= 23 ) - goto LABEL_8; - v4 = 255; - v1 = 212; - v2 = 150; - return TargetColor(v2, v1, v4); -} - //----- (004583B0) -------------------------------------------------------- LevelDecoration::LevelDecoration() { @@ -4441,450 +3749,6 @@ this->uCog = 0; } -//----- (00458600) -------------------------------------------------------- -void DecorationList::ToFile() -{ - DecorationList *v1; // esi@1 - FILE *v2; // eax@1 - FILE *v3; // edi@1 - - v1 = this; - v2 = fopen("data\\ddeclist.bin", "wb"); - v3 = v2; - if ( !v2 ) - Abortf("Unable to save ddeclist.bin!"); - fwrite(v1, 4u, 1u, v2); - fwrite(v1->pDecorations, 0x54u, v1->uNumDecorations, v3); - fclose(v3); -} - -//----- (0045864C) -------------------------------------------------------- -void DecorationList::FromFile(void *pSerialized) -{ - uNumDecorations = *(int *)pSerialized; - pDecorations = (DecorationDesc *)pAllocator->AllocNamedChunk(pDecorations, - 84 * uNumDecorations, "Dec Descrip"); - memcpy(pDecorations, (char *)pSerialized + 4, 84 * uNumDecorations); -} - -//----- (00458693) -------------------------------------------------------- -void DecorationList::InitializeDecorationSprite(unsigned int uDecID) -{ - pSpriteFrameTable->InitializeSprite(this->pDecorations[uDecID].uSpriteID); -} - -//----- (004586B0) -------------------------------------------------------- -bool DecorationList::FromFileTxt(const char *Args) -{ - DecorationList *v2; // ebx@1 - FILE *v3; // eax@1 - unsigned int v4; // esi@3 - void *v5; // eax@10 - FILE *v6; // ST18_4@12 - char *i; // eax@12 - unsigned __int16 v8; // ax@16 - const char *v9; // ST20_4@16 - const char *v10; // ST18_4@16 - __int16 v11; // ax@16 - const char *v12; // ST14_4@16 - unsigned __int16 v13; // ax@16 - const char *v14; // ST10_4@16 - __int16 v15; // ax@16 - const char *v16; // ST0C_4@16 - unsigned __int8 v17; // al@16 - const char *v18; // ST08_4@16 - unsigned __int8 v19; // al@16 - const char *v20; // ST04_4@16 - unsigned __int8 v21; // al@16 - const char *v22; // ST00_4@16 - unsigned __int8 v23; // zf@16 - char v24; // sf@16 - unsigned __int8 v25; // of@16 - int j; // edi@17 - const char *v27; // esi@18 - int v28; // eax@19 - int v29; // eax@21 - int v30; // eax@23 - int v31; // eax@25 - int v32; // eax@27 - int v33; // eax@29 - int v34; // eax@31 - int v35; // eax@33 - FrameTableTxtLine v37; // [sp+Ch] [bp-460h]@17 - FrameTableTxtLine v38; // [sp+88h] [bp-3E4h]@13 - char Dest; // [sp+104h] [bp-368h]@17 - char Buf; // [sp+17Ch] [bp-2F0h]@3 - FrameTableTxtLine v41; // [sp+370h] [bp-FCh]@4 - FrameTableTxtLine v42; // [sp+3ECh] [bp-80h]@4 - FILE *File; // [sp+468h] [bp-4h]@1 - unsigned int Argsa; // [sp+474h] [bp+8h]@3 - - v2 = this; - v3 = fopen(Args, "r"); - File = v3; - if ( !v3 ) - Abortf("DecorationDescriptionList::load - Unable to open file: %s."); - v4 = 0; - Argsa = 0; - if ( fgets(&Buf, 490, v3) ) - { - do - { - *strchr(&Buf, 10) = 0; - memcpy(&v42, frame_table_txt_parser(&Buf, &v41), sizeof(v42)); - if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 ) - ++Argsa; - } - while ( fgets(&Buf, 490, File) ); - v4 = Argsa; - } - v2->uNumDecorations = v4; - v5 = pAllocator->AllocNamedChunk(v2->pDecorations, 84 * v4, "Dec Descrip"); - v2->pDecorations = (DecorationDesc *)v5; - if ( !v5 ) - Abortf("DecorationDescriptionList::load - Out of Memory!"); - v6 = File; - v2->uNumDecorations = 0; - fseek(v6, 0, 0); - for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) - { - *strchr(&Buf, 10) = 0; - memcpy(&v42, frame_table_txt_parser(&Buf, &v38), sizeof(v42)); - if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 ) - { - strcpy(v2->pDecorations[v2->uNumDecorations].pName, v42.pProperties[1]); - v8 = pSpriteFrameTable->FastFindSprite(v2->pDecorations[v2->uNumDecorations].pName); - v9 = v42.pProperties[2]; - v2->pDecorations[v2->uNumDecorations].uSpriteID = v8; - strcpy(v2->pDecorations[v2->uNumDecorations].field_20, v9); - v10 = v42.pProperties[3]; - v2->pDecorations[v2->uNumDecorations].uType = 0; - v11 = atoi(v10); - v12 = v42.pProperties[4]; - v2->pDecorations[v2->uNumDecorations].uRadius = v11; - v13 = atoi(v12); - v14 = v42.pProperties[5]; - v2->pDecorations[v2->uNumDecorations].uDecorationHeight = v13; - v15 = atoi(v14); - v16 = v42.pProperties[6]; - v2->pDecorations[v2->uNumDecorations].uLightRadius = v15; - v17 = atoi(v16); - v18 = v42.pProperties[7]; - v2->pDecorations[v2->uNumDecorations].uColoredLightRed = v17; - v19 = atoi(v18); - v20 = v42.pProperties[8]; - v2->pDecorations[v2->uNumDecorations].uColoredLightGreen = v19; - v21 = atoi(v20); - v22 = v42.pProperties[9]; - v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = v21; - v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v22); - v25 = __OFSUB__(v42.uPropCount, 10); - v23 = v42.uPropCount == 10; - v24 = v42.uPropCount - 10 < 0; - v2->pDecorations[v2->uNumDecorations].uFlags = 0; - if ( !((unsigned __int8)(v24 ^ v25) | v23) ) - { - strcpy(&Dest, v42.pProperties[10]); - memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41)); - for ( j = 0; j < v41.uPropCount; ++j ) - { - v27 = v41.pProperties[j]; - if ( _stricmp(v41.pProperties[j], "NBM") ) - { - if ( _stricmp(v27, "Invisible") ) - { - if ( _stricmp(v27, "FS") ) - { - if ( _stricmp(v27, "FM") ) - { - if ( _stricmp(v27, "FF") ) - { - if ( _stricmp(v27, "Marker") ) - { - if ( _stricmp(v27, "LoopSlow") ) - { - if ( _stricmp(v27, "EmitFire") ) - { - if ( _stricmp(v27, "Dawn") ) - { - if ( !_stricmp(v27, "Dusk") ) - HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 2u; - } - else - { - HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 1u; - } - } - else - { - v35 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; - *(char *)v35 |= 0x80u; - } - } - else - { - v34 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; - *(char *)v34 |= 0x40u; - } - } - else - { - v33 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; - *(char *)v33 |= 0x20u; - } - } - else - { - v32 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; - *(char *)v32 |= 0x10u; - } - } - else - { - v31 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; - *(char *)v31 |= 8u; - } - } - else - { - v30 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; - *(char *)v30 |= 4u; - } - } - else - { - v29 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; - *(char *)v29 |= 2u; - } - } - else - { - v28 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags; - *(char *)v28 |= 1u; - } - } - } - ++v2->uNumDecorations; - } - } - fclose(File); - return 1; -} - -//----- (00459064) -------------------------------------------------------- -void ObjectList::InitializeSprites() -{ - for (uint i = 0; i < uNumObjects; ++i) - pSpriteFrameTable->InitializeSprite(pObjects[i].uSpriteID); -} - -//----- (00459090) -------------------------------------------------------- -void ObjectList::ToFile() -{ - ObjectList *v1; // esi@1 - FILE *v2; // eax@1 - FILE *v3; // edi@1 - - v1 = this; - v2 = fopen("data\\dobjlist.bin", "wb"); - v3 = v2; - if ( !v2 ) - Abortf("Unable to save dobjlist.bin!"); - fwrite(v1, 4u, 1u, v2); - fwrite(v1->pObjects, 0x38u, v1->uNumObjects, v3); - fclose(v3); -} - -//----- (004590DC) -------------------------------------------------------- -void ObjectList::FromFile(void *pSerialized) -{ - uNumObjects = *(int *)pSerialized; - pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, 56 * uNumObjects, "Obj Descrip"); - memcpy(pObjects, (char *)pSerialized + 4, 56 * uNumObjects); -} - -//----- (00459123) -------------------------------------------------------- -bool ObjectList::FromFileTxt(const char *Args) -{ - ObjectList *v2; // ebx@1 - __int32 v3; // edi@1 - FILE *v4; // eax@1 - unsigned int v5; // esi@3 - void *v6; // eax@9 - FILE *v7; // ST0C_4@11 - char *i; // eax@11 - unsigned __int16 v9; // ax@14 - const char *v10; // ST20_4@14 - __int16 v11; // ax@14 - const char *v12; // ST1C_4@14 - __int16 v13; // ax@14 - const char *v14; // ST18_4@14 - __int16 v15; // ax@14 - const char *v16; // ST14_4@14 - __int16 v17; // ax@14 - const char *v18; // ST10_4@14 - __int16 v19; // ax@14 - const char *v20; // ST0C_4@14 - int v21; // esi@16 - const char *v22; // edi@16 - int v23; // eax@17 - int v24; // eax@19 - int v25; // eax@21 - int v26; // eax@21 - int v27; // eax@21 - int v28; // eax@23 - int v29; // eax@25 - int v30; // eax@27 - int v31; // eax@29 - const char *v32; // edi@30 - const char *v33; // ST20_4@35 - int v34; // eax@35 - char v35; // al@35 - const char *v36; // ST1C_4@35 - char v37; // al@35 - const char *v38; // ST18_4@35 - FrameTableTxtLine v40; // [sp+8h] [bp-460h]@14 - FrameTableTxtLine v41; // [sp+84h] [bp-3E4h]@12 - char Dest; // [sp+100h] [bp-368h]@14 - char Buf; // [sp+178h] [bp-2F0h]@3 - FrameTableTxtLine v44; // [sp+36Ch] [bp-FCh]@4 - FrameTableTxtLine v45; // [sp+3E8h] [bp-80h]@4 - FILE *File; // [sp+464h] [bp-4h]@1 - unsigned int Argsa; // [sp+470h] [bp+8h]@3 - int Argsb; // [sp+470h] [bp+8h]@15 - - v2 = this; - pAllocator->FreeChunk(this->pObjects); - v3 = 0; - v2->pObjects = 0; - v2->uNumObjects = 0; - v4 = fopen(Args, "r"); - File = v4; - if ( !v4 ) - Abortf("ObjectDescriptionList::load - Unable to open file: %s."); - v5 = 0; - Argsa = 0; - if ( fgets(&Buf, 490, v4) ) - { - do - { - *strchr(&Buf, 10) = 0; - memcpy(&v45, frame_table_txt_parser(&Buf, &v44), sizeof(v45)); - if ( v45.uPropCount && *v45.pProperties[0] != '/' ) - ++Argsa; - } - while ( fgets(&Buf, 490, File) ); - v5 = Argsa; - v3 = 0; - } - v2->uNumObjects = v5; - v6 = pAllocator->AllocNamedChunk(v2->pObjects, 56 * v5, "Obj Descrip"); - v2->pObjects = (ObjectDesc *)v6; - if ( v6 == (void *)v3 ) - Abortf("ObjectDescriptionList::load - Out of Memory!"); - memset(v6, v3, 56 * v2->uNumObjects); - v7 = File; - v2->uNumObjects = v3; - fseek(v7, v3, v3); - for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) - { - *strchr(&Buf, 10) = 0; - memcpy(&v45, frame_table_txt_parser(&Buf, &v41), sizeof(v45)); - if ( v45.uPropCount && *v45.pProperties[0] != 47 ) - { - strcpy(v2->pObjects[v2->uNumObjects].field_0, v45.pProperties[0]); - v9 = pSpriteFrameTable->FastFindSprite((char *)v45.pProperties[1]); - v10 = v45.pProperties[2]; - v2->pObjects[v2->uNumObjects].uSpriteID = v9; - v11 = atoi(v10); - v12 = v45.pProperties[3]; - v2->pObjects[v2->uNumObjects].uObjectID = v11; - v13 = atoi(v12); - v14 = v45.pProperties[4]; - v2->pObjects[v2->uNumObjects].uRadius = v13; - v15 = atoi(v14); - v16 = v45.pProperties[5]; - v2->pObjects[v2->uNumObjects].uHeight = v15; - v17 = atoi(v16); - v18 = v45.pProperties[6]; - v2->pObjects[v2->uNumObjects].uLifetime = v17; - v19 = atoi(v18); - v20 = v45.pProperties[7]; - v2->pObjects[v2->uNumObjects].uSpeed = v19; - strcpy(&Dest, v20); - memcpy(&v44, frame_table_txt_parser(&Dest, &v40), sizeof(v44)); - if ( v45.uPropCount > 7 ) - { - for ( Argsb = 0; Argsb < v44.uPropCount; ++Argsb ) - { - v21 = Argsb; - v22 = v44.pProperties[Argsb]; - if ( !_stricmp(v44.pProperties[Argsb], "NoDraw") ) - { - v23 = (int)&v2->pObjects[v2->uNumObjects].uFlags; - *(char *)v23 |= 1u; - } - if ( !_stricmp(v22, "Lifetime") ) - { - v24 = (int)&v2->pObjects[v2->uNumObjects].uFlags; - *(char *)v24 |= 4u; - } - if ( !_stricmp(v22, "FTLifetime") ) - { - v25 = (int)&v2->pObjects[v2->uNumObjects]; - *(short *)(v25 + 42) = 8 * pSpriteFrameTable->pSpriteSFrames[*(short *)(v25 + 40)].uAnimLength; - v26 = (int)&v2->pObjects[v2->uNumObjects].uFlags; - *(char *)v26 |= 8u; - v27 = (int)&v2->pObjects[v2->uNumObjects].uFlags; - *(char *)v27 |= 4u; - } - if ( !_stricmp(v22, "NoPickup") ) - { - v28 = (int)&v2->pObjects[v2->uNumObjects].uFlags; - *(char *)v28 |= 0x10u; - } - if ( !_stricmp(v22, "NoGravity") ) - { - v29 = (int)&v2->pObjects[v2->uNumObjects].uFlags; - *(char *)v29 |= 0x20u; - } - if ( !_stricmp(v22, "FlagOnIntercept") ) - { - v30 = (int)&v2->pObjects[v2->uNumObjects].uFlags; - *(char *)v30 |= 0x40u; - } - if ( !_stricmp(v22, "Bounce") ) - { - v31 = (int)&v2->pObjects[v2->uNumObjects].uFlags; - *(char *)v31 |= 0x80u; - } - v32 = v45.pProperties[v21]; - if ( !_stricmp(v45.pProperties[v21], "Fire") ) - HIBYTE(v2->pObjects[v2->uNumObjects].uFlags) |= 2u; - if ( !_stricmp(v32, "Lines") ) - HIBYTE(v2->pObjects[v2->uNumObjects].uFlags) |= 4u; - if ( !_stricmp(v44.pProperties[v21], "bits") ) - { - v33 = v44.pProperties[v21 + 1]; - v34 = (int)&v2->pObjects[v2->uNumObjects].uFlags; - *(char *)(v34 + 1) |= 1u; - v35 = atoi(v33); - v36 = v44.pProperties[v21 + 2]; - v2->pObjects[v2->uNumObjects].uParticleTrailColorR = v35; - v37 = atoi(v36); - v38 = v44.pProperties[v21 + 3]; - v2->pObjects[v2->uNumObjects].uParticleTrailColorG = v37; - v2->pObjects[v2->uNumObjects].uParticleTrailColorB = atoi(v38); - } - } - } - ++v2->uNumObjects; - } - } - fclose(File); - return 1; -} - //----- (0045E03A) -------------------------------------------------------- unsigned short * MakeScreenshot( signed int width, signed int height ) { @@ -5058,52 +3922,6 @@ return pPixels; } -//----- (0045E26C) -------------------------------------------------------- -void __thiscall SaveScreenshot(const char *pFilename) -{ - const char *v1; // edi@1 - unsigned __int16 *v2; // esi@1 - - v1 = pFilename; - v2 = MakeScreenshot(92, 68); - pRenderer->SavePCXImage(v1, (char *)v2, 92, 68); - free(v2); -} - -//----- (00460706) -------------------------------------------------------- -void TryLoadLevelFromLOD() -{ - FILE *v0; // eax@1 - FILE *v1; // esi@1 - __int32 v2; // edi@2 - char Ext[256]; // [sp+4h] [bp-40Ch]@1 - char Dir[256]; // [sp+104h] [bp-30Ch]@1 - char Filename[256]; // [sp+204h] [bp-20Ch]@1 - char a1[260]; // [sp+304h] [bp-10Ch]@1 - char Drive[4]; // [sp+408h] [bp-8h]@1 - int DstBuf; // [sp+40Ch] [bp-4h]@2 - - strcpy(a1, pCurrentMapName.data()); - _splitpath(a1, Drive, Dir, Filename, Ext); - sprintf(a1, "levels\\%s%s", Filename, ".lod"); - v0 = fopen(a1, "rb"); - v1 = v0; - if ( v0 ) - { - fseek(v0, 0, 2); - v2 = ftell(v1); - rewind(v1); - ptr_6A0D08 = pAllocator->AllocNamedChunk(ptr_6A0D08, v2, "LevelLod"); - fread(ptr_6A0D08, v2, 1u, v1); - fseek(v1, v2 - 6, 0); - DstBuf = 0; - fread(&DstBuf, 4u, 1u, v1); - fread(&_6A0D10_txt_lod_loading__unused, 2u, 1u, v1); - _6A0D0C_txt_lod_loading = (int)((char *)ptr_6A0D08 + DstBuf); - fclose(v1); - } -} - //----- (0046080D) -------------------------------------------------------- void __cdecl sub_46080D() { @@ -5126,66 +3944,6 @@ return false; } -//----- (0046086A) -------------------------------------------------------- -void SaveNewGame() -{ - FILE *v3; // eax@7 - void *pSave; // [sp+170h] [bp-8h]@3 - - if ( pVideoPlayer->AnyMovieLoaded() ) - pVideoPlayer->Unload(); - pSave = pAllocator->AllocNamedChunk(0, 1000000, 0); - pNew_LOD->CloseWriteFile(); - remove("data\\new.lod"); - - LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3 - strcpy(this_.LodVersion, "MMVII"); - strcpy(this_.LodDescription, "newmaps for MMVII"); - this_.LODSize = 100; - this_.dword_0000A8 = 0; - - LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3 - a3.dword_000018 = 0; - a3.word_00001E = 0; - strcpy(a3.pFilename, "current"); - pNew_LOD->CreateNewLod(&this_, &a3, "data\\new.lod"); - if (pNew_LOD->LoadFile("data\\new.lod", false)) - { - pNew_LOD->CreateTempFile(); - pNew_LOD->uNumSubDirs = 0; - - LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4 - for (int i = pGames_LOD->uNumSubDirs / 2; i < pGames_LOD->uNumSubDirs; ++i) - { - memcpy(&pDir, &pGames_LOD->pSubIndices[i], sizeof(pDir)); - v3 = pGames_LOD->FindContainer(pGames_LOD->pSubIndices[i].pFilename, 1); - fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3); - pNew_LOD->AppendDirectory(&pDir, pSave); - } - - LOD::Directory save_game_dir; // [sp+12Ch] [bp-4Ch]@9 - strcpy(pSavegameHeader[0].pLocationName, "out01.odm"); - strcpy(save_game_dir.pFilename, "header.bin"); - save_game_dir.uDataSize = sizeof(SavegameHeader); - pNew_LOD->AppendDirectory(&save_game_dir, &pSavegameHeader[0]); - - pNew_LOD->FixDirectoryOffsets(); - pParty->vPrevPosition.y = 0; - pParty->vPrevPosition.x = 12552; - pParty->vPosition.x = 12552; - pParty->vPosition.z = 0; - pParty->uFallStartY = 0; - pParty->sPrevRotationX = 0; - pParty->sRotationX = 0; - pParty->vPrevPosition.z = 1816; - pParty->vPosition.y = 1816; - pParty->sPrevRotationY = 512; - pParty->sRotationY = 512; - SaveGame(1, 1); - } - pAllocator->FreeChunk(pSave); -} - //----- (004610AA) -------------------------------------------------------- void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2) { @@ -5609,35 +4367,6 @@ pIcons_LOD->_4114F2(); } -void set_stru1_field_8_InArcomage(int inValue) -{ - switch(inValue) - { - case 91:LOBYTE(pArcomageGame->stru1.field_8) = 123;break; - case 92:LOBYTE(pArcomageGame->stru1.field_8) = 124;break; - case 93:LOBYTE(pArcomageGame->stru1.field_8) = 125;break; - case 96:LOBYTE(pArcomageGame->stru1.field_8) = 126;break; - case 61:LOBYTE(pArcomageGame->stru1.field_8) = 43;break; - case 55:LOBYTE(pArcomageGame->stru1.field_8) = 38;break; - case 56:LOBYTE(pArcomageGame->stru1.field_8) = 42;break; - case 57:LOBYTE(pArcomageGame->stru1.field_8) = 40;break; - case 59:LOBYTE(pArcomageGame->stru1.field_8) = 58;break; - case 54:LOBYTE(pArcomageGame->stru1.field_8) = 94;break; - case 50:LOBYTE(pArcomageGame->stru1.field_8) = 64;break; - case 51:LOBYTE(pArcomageGame->stru1.field_8) = 35;break; - case 52:LOBYTE(pArcomageGame->stru1.field_8) = 36;break; - case 53:LOBYTE(pArcomageGame->stru1.field_8) = 37;break; - case 49:LOBYTE(pArcomageGame->stru1.field_8) = 33;break; - case 39:LOBYTE(pArcomageGame->stru1.field_8) = 34;break; - case 44:LOBYTE(pArcomageGame->stru1.field_8) = 60;break; - case 46:LOBYTE(pArcomageGame->stru1.field_8) = 62;break; - case 47:LOBYTE(pArcomageGame->stru1.field_8) = 63;break; - case 48:LOBYTE(pArcomageGame->stru1.field_8) = 41;break; - default:LOBYTE(pArcomageGame->stru1.field_8) = inValue;break; - } -} - - //----- (004637EB) -------------------------------------------------------- int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) { @@ -7986,21 +6715,6 @@ return uCurrentMenuID; } -//----- (00467F48) -------------------------------------------------------- -void CreateMsgScrollWindow( signed int mscroll_id ) - { - signed int v1; // esi@1 - - v1 = mscroll_id; - if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 ) - { - if ( mscroll_id <= 782 ) - { - uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE); - pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Scroll, v1 - 700, 0); - } - } -} // 720980: using guessed type int uTextureID_720980; //----- (00467F9F) -------------------------------------------------------- @@ -8013,52 +6727,6 @@ } } -//----- (00467FB6) -------------------------------------------------------- -void CreateScrollWindow() - { - unsigned int v0; // eax@1 - char *v1; // ST18_4@3 - unsigned int v2; // eax@3 - GUIWindow a1; // [sp+Ch] [bp-54h]@1 - - memcpy(&a1, pGUIWindow_ScrollWindow, sizeof(a1)); - a1.Hint = 0; - a1.uFrameX = 1; - a1.uFrameY = 1; - a1.uFrameWidth = 468; - v0 = pFontSmallnum->CalcTextHeight(pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], &a1, 0, 0) - + 2 * LOBYTE(pFontCreate->uFontHeight) - + 24; - a1.uFrameHeight = v0; - if ( (signed int)(v0 + a1.uFrameY) > 479 ) - { - v0 = 479 - a1.uFrameY; - a1.uFrameHeight = 479 - a1.uFrameY; - } - a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1; - a1.uFrameW = v0 + a1.uFrameY - 1; - a1.DrawMessageBox(0); - a1.uFrameX += 12; - a1.uFrameWidth -= 24; - a1.uFrameY += 12; - a1.uFrameHeight -= 12; - a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1; - a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; - v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName; - v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf.data(), format_4E2D80, v2, v1); - a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u); - a1.DrawText( - pFontSmallnum, - 1, - LOBYTE(pFontCreate->uFontHeight) - 3, - 0, - pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], - 0, - 0, - 0); -} - //----- (00468F8A) -------------------------------------------------------- void __cdecl OnPaperdollLeftClick() { @@ -9294,167 +7962,6 @@ } } -//----- (0046BDF1) -------------------------------------------------------- -void __cdecl BLV_UpdateUserInputAndOther() -{ - UpdateObjects(); - BLV_ProcessPartyActions(); - UpdateActors_BLV(); - BLV_UpdateDoors(); - check_event_triggers(); -} - -//----- (0046BE0A) -------------------------------------------------------- -void __cdecl ODM_UpdateUserInputAndOther() -{ - bool v0; // eax@5 - char pOut[32]; // [sp+8h] [bp-20h]@5 - - UpdateObjects(); - ODM_ProcessPartyActions(); - if ( pParty->vPosition.x < -22528 - || pParty->vPosition.x > 22528 - || pParty->vPosition.y < -22528 - || pParty->vPosition.y > 22528 ) - { - strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); - v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 32); - if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 ) - { - if ( pParty->vPosition.x < -22528 ) - pParty->vPosition.x = -22528; - if ( pParty->vPosition.x > 22528 ) - pParty->vPosition.x = 22528; - if ( pParty->vPosition.y < -22528 ) - pParty->vPosition.y = -22528; - if ( pParty->vPosition.y > 22528 ) - pParty->vPosition.y = 22528; - } - else - { - pAudioPlayer->StopChannels(-1, -1); - TravelUI_Load(); - } - } - UpdateActors_ODM(); - check_event_triggers(); -} - -//----- (0046BEF1) -------------------------------------------------------- -void SpriteObject::_46BEF1_apply_spells_aoe() -{ - SpriteObject *v1; // edi@1 - Actor *v2; // esi@2 - __int16 v3; // fps@4 - unsigned __int8 v4; // c0@4 - unsigned __int8 v5; // c3@4 - signed int v6; // [sp+8h] [bp-4h]@1 - - int v7,v8,v9,v10,v11; - - v6 = 0; - v1 = this; - if ( (signed int)uNumActors > 0 ) - { - v2 = pActors.data();//[0].vPosition.y; - do - { - if ( v2->CanAct() ) - { - //UNDEF(v3); - //.text:0046BF26 movsx eax, word ptr [esi-2] - //.text:0046BF2A sub eax, [edi+4] - //.text:0046BF31 mov [ebp+var_8], eax - //.text:0046BF37 fild [ebp+var_8] - // v7 pushed to stack - v7 = v2->vPosition.x - this->vPosition.x; - - //.text:0046BF2D movsx ecx, word ptr [esi+2] - v8 = v2->vPosition.z; - - //.text:0046BF34 movsx eax, word ptr [esi] - //.text:0046BF3A sub eax, [edi+8] - //.text:0046BF3D mov [ebp+var_8], eax - //.text:0046BF44 fild [ebp+var_8] - // v9 pushed to stack - v9 = v2->vPosition.y - this->vPosition.y; - - //.text:0046BF40 movsx eax, word ptr [esi-6] - //.text:0046BF47 sar eax, 1 - //.text:0046BF49 add eax, ecx - //.text:0046BF4B sub eax, [edi+0Ch] - //.text:0046BF4E mov [ebp+var_8], eax - //.text:0046BF51 fild [ebp+var_8] - //.text:0046BF58 fld st - // v10 pushed to stack, two times - v10 = v2->uActorHeight / 2 + v8 - this->vVelocity.y; - - //.text:0046BF54 movsx eax, word ptr [esi-8] - //.text:0046BF5A add eax, 100h - //.text:0046BF63 mov ecx, eax - v11 = this->vVelocity.x; - - //.text:0046BF5F fmul st, st(1) - // stack: v10*v10, v10, v9, v7 - //.text:0046BF61 fld st(2) - // stack: v7, v10*v10, v10, v9, v7 - - - //.text:0046BF65 fmul st, st(3) - // stack: v7*v9, v10*v10, v10, v9, v7 - - //.text:0046BF67 imul ecx, eax - v11 = v11 * v11; - - //.text:0046BF6A faddp st(1), st - // stack: v10*v10+v7*v9, v10, v9, v7 - //.text:0046BF6C fld st(3) - // stack: v7, v10*v10+v7*v9, v10, v9, v7 - //.text:0046BF6E fmul st, st(4) - // stack: v7*v7, v10*v10+v7*v9, v10, v9, v7 - //.text:0046BF70 faddp st(1), st - // stack: v10*v10+v7*v9+v7*v7, v10, v9, v7 - - //.text:0046BF72 mov [ebp+var_8], ecx - //.text:0046BF75 fild [ebp+var_8] - // v11 pushed to stack - - //.text:0046BF78 fcompp - // if ( v11 > v10*v10+v7*v9+v7*v7 ) - // stack: v10, v9, v7 - - //.text:0046BF7A fstp st - // stack: v9, v7 - - //.text:0046BF7C fnstsw ax - //.text:0046BF7E fstp st - // stack: v7 - - //.text:0046BF80 test ah, 41h - //.text:0046BF83 fstp st - //.text:0046BF85 jnz short loc_46BFDD - - if ( v11 >= v10*v10+v7*v9+v7*v7 ) - { - if ( stru_50C198.GetMagicalResistance(v2, 0xAu) ) - { - v2->pActorBuffs[v1->spell_id].Apply( - pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->spell_level << 7) * 0.033333335), - v1->spell_skill, - 4u, - 0, - 0); - HIWORD(v2->uAttributes) |= 8u; - } - } - } - ++v6; - ++v2; - } - while ( v6 < (signed int)uNumActors ); - } -} - //----- (0046BFFA) -------------------------------------------------------- bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) {
--- a/mm7_3.cpp Sat Jun 15 23:58:32 2013 +0600 +++ b/mm7_3.cpp Sun Jun 23 14:02:07 2013 +0600 @@ -12648,35 +12648,6 @@ } } -//----- (004488B6) -------------------------------------------------------- -unsigned __int16 DecorationList::GetDecorIdByName(const char *pName) -{ - DecorationList *v2; // esi@1 - signed int uID; // edi@2 - signed int v4; // ebx@3 - unsigned __int16 result; // ax@6 - - v2 = this; - if ( pName && (uID = 1, (signed int)this->uNumDecorations > 1) ) - { - v4 = 1; - while ( _stricmp(pName, v2->pDecorations[v4].pName) ) - { - ++uID; - ++v4; - if ( uID >= (signed int)v2->uNumDecorations ) - goto LABEL_6; - } - result = uID; - } - else - { -LABEL_6: - result = 0; - } - return result; -} - //----- (0044892E) -------------------------------------------------------- void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on) {