# HG changeset patch # User Nomad # Date 1361548061 -7200 # Node ID 7f817679b60e66b83ebce55e13b5d2292c6bb4d5 # Parent 85edec9da96bac4ef4da3fa6ec7e32928c38001e _42777D_CastSpell_UseWand_ShootArrow diff -r 85edec9da96b -r 7f817679b60e GUIWindow.cpp --- a/GUIWindow.cpp Fri Feb 22 01:36:54 2013 +0200 +++ b/GUIWindow.cpp Fri Feb 22 17:47:41 2013 +0200 @@ -1040,11 +1040,11 @@ int v9; // eax@50 unsigned int v10; // [sp-10h] [bp-C8h]@53 unsigned __int16 v11; // [sp-Ch] [bp-C4h]@53 - unsigned int v12; // [sp-Ch] [bp-C4h]@60 + //unsigned int v12; // [sp-Ch] [bp-C4h]@60 char *v13; // [sp-8h] [bp-C0h]@50 - unsigned int v14; // [sp-8h] [bp-C0h]@60 + //unsigned int v14; // [sp-8h] [bp-C0h]@60 unsigned int v15; // [sp-4h] [bp-BCh]@50 - Texture *v16; // [sp-4h] [bp-BCh]@60 + //Texture *v16; // [sp-4h] [bp-BCh]@60 GUIWindow w; // [sp+Ch] [bp-ACh]@4 GUIWindow v18; // [sp+60h] [bp-58h]@2 int v19; // [sp+B4h] [bp-4h]@2 @@ -1057,7 +1057,7 @@ v1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); + pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_507B04]); if ( array_5913D8[6] != (NPCData *)uNumDialogueNPCPortraits || !uHouse_ExitPic ) { w.uFrameWidth = 130; @@ -1092,8 +1092,7 @@ w.uFrameZ = 457; v5 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0); v6 = v5 + 7; - pRenderer->_4A6A68(8, 352 - (v5 + 7), (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), - (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v5 + 7)); + pRenderer->_4A6A68(8, 352 - (v5 + 7), &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (v5 + 7)); pRenderer->DrawTextureIndexed(8u, 347 - v6, pTexture_591428); v7 = FitTextInAWindow(ptr_F8B1E8, pFontArrus, &w, 0xDu, 0); window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0); @@ -1105,7 +1104,7 @@ { pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, - (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); + &pIcons_LOD->pTextures[uTextureID_50795C]); pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6), *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6), pDialogueNPCPortraits[v8]); if ( uNumDialogueNPCPortraits < 4 ) @@ -1143,8 +1142,7 @@ goto LABEL_56; } v4 = (char *)array_5913D8[6] - 1; - pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, - (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[(signed int)v4]); if ( pCurrentScreen == SCREEN_E ) { @@ -1233,18 +1231,13 @@ LABEL_58: if ( array_5913D8[6] == (NPCData *)uNumDialogueNPCPortraits && uHouse_ExitPic ) { - pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); - v16 = (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0); - v14 = 451; - v12 = 476; + pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); + pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); } else { - v16 = (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0); - v14 = 445; - v12 = 471; + pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uTextureID_506438]); } - pRenderer->DrawTextureIndexed(v12, v14, v16); } diff -r 85edec9da96b -r 7f817679b60e GUIWindow.h --- a/GUIWindow.h Fri Feb 22 01:36:54 2013 +0200 +++ b/GUIWindow.h Fri Feb 22 17:47:41 2013 +0200 @@ -190,7 +190,7 @@ UIMSG_PlayerCreationRemoveUpSkill = 0x4A, UIMSG_PlayerCreationRemoveDownSkill = 0x4B, UIMSG_4E = 0x4E, - UIMSG_4F = 0x4F, + UIMSG_SPellbook_ShowHightlightedSpellInfo = 0x4F, UIMSG_51 = 0x51, UIMSG_LoadGame = 0x52, UIMSG_SaveGame = 0x53, @@ -240,7 +240,7 @@ UIMSG_SelectDialogueOption = 0x88, UIMSG_8C = 0x8C, UIMSG_8D = 0x8D, - UIMSG_8E = 0x8E, + UIMSG_CastSpellFromBook = 0x8E, UIMSG_8F = 0x8F, UIMSG_PlayerCreation_VoicePrev = 0x90, UIMSG_PlayerCreation_VoiceNext = 0x91, diff -r 85edec9da96b -r 7f817679b60e TurnEngine.h --- a/TurnEngine.h Fri Feb 22 01:36:54 2013 +0200 +++ b/TurnEngine.h Fri Feb 22 17:47:41 2013 +0200 @@ -17,6 +17,19 @@ #pragma pack(push, 1) struct stru262_TurnBased { + inline stru262_TurnBased() + { + field_0 = 0; + field_4 = 0; + field_8 = 0; + uActorQueueSize = 0; + field_10 = 0; + uActionPointsLeft = 0; + field_18 = 0; + field_1C = 0; + memset(pQueue, 0, sizeof(pQueue)); + } + signed int _404544(); void _40471C(); signed int Start(); diff -r 85edec9da96b -r 7f817679b60e mm7_4.cpp --- a/mm7_4.cpp Fri Feb 22 01:36:54 2013 +0200 +++ b/mm7_4.cpp Fri Feb 22 17:47:41 2013 +0200 @@ -5915,15 +5915,7 @@ && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement { pControlParam = pControlsHead->uControlParam; - if ( (signed int)pNumMessage < 40 ) - { - pMessageQueue_50CBD0->pMessages[pNumMessage].eType = (UIMessageType)pControlsHead->field_1C; - //pTexture = &pTexture_PCX; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = pControlParam; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - pNumMessage = pMessageQueue_50CBD0->uNumMessages + 1; - ++pMessageQueue_50CBD0->uNumMessages; - } + pMessageQueue_50CBD0->SendMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0); v1 = 0; } pControlsHead = pControlsHead->pNext; diff -r 85edec9da96b -r 7f817679b60e mm7_5.cpp --- a/mm7_5.cpp Fri Feb 22 01:36:54 2013 +0200 +++ b/mm7_5.cpp Fri Feb 22 17:47:41 2013 +0200 @@ -2970,7 +2970,7 @@ //_set_status_string_pTmpBuf_and_continue: sub_41C0B8_set_status_string(pTmpBuf); continue; - case UIMSG_4F: + case UIMSG_SPellbook_ShowHightlightedSpellInfo: if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) ) continue; @@ -3124,17 +3124,12 @@ } } continue; - case UIMSG_8E: - if ( pTurnEngine->field_4 == 3 ) - continue; - v175 = 0; - v159 = 0; - v147 = 0; - //goto LABEL_678; - v80 = v199; - v79 = uMessageParam; - _42777D_CastSpell_UseWand_ShootArrow(v79, v80, v147, v159, v175); - continue; + + case UIMSG_CastSpellFromBook: + if ( pTurnEngine->field_4 != 3 ) + _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); + continue; + case UIMSG_92: if ( pTurnEngine->field_4 != 3 ) { diff -r 85edec9da96b -r 7f817679b60e mm7_6.cpp --- a/mm7_6.cpp Fri Feb 22 01:36:54 2013 +0200 +++ b/mm7_6.cpp Fri Feb 22 17:47:41 2013 +0200 @@ -42,6 +42,7 @@ #include "texts.h" #include "StorylineTextTable.h" #include "Events2D.h" +#include "Log.h" #include "mm7_data.h" @@ -2172,7 +2173,7 @@ //----- (0042777D) -------------------------------------------------------- void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6) { - bool result; // eax@2 + //bool result; // eax@2 __int16 v6; // bx@4 Player *v7; // eax@4 char v8; // zf@12 @@ -2202,9 +2203,16 @@ a3a = uPlayerID; a2a = a1; - if ( pParty->bTurnBasedModeOn != 1 - || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) + + //if ( pParty->bTurnBasedModeOn != 1 + // || (result = pTurnEngine->field_4, pTurnEngine->field_4 != 1) && pTurnEngine->field_4 != 3 ) + if (pParty->bTurnBasedModeOn) { + if (pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3) + return; + } + + v6 = a5; v7 = &pParty->pPlayers[uPlayerID]; if ( !(a5 & 0x10) ) @@ -2317,6 +2325,7 @@ break; } } + v15 = pStru277; if ( v6 & 0x3CA ) { @@ -2349,7 +2358,7 @@ ++v15; } while ( (signed int)v15 < (signed int)&unk_50C190 ); - result = pStru277->PushStru277(a2a, a3a, a4, v6, a6); + int result = pStru277->PushStru277(a2a, a3a, a4, v6, a6); if ( result != -1 ) { if ( v6 & 2 ) @@ -2469,7 +2478,6 @@ pGUIWindow_Settings->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x8Fu, 5u, 0x36u, "", 0); } } - } }