Mercurial > mm7
diff mm7_6.cpp @ 2331:9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
author | Grumpy7 |
---|---|
date | Wed, 02 Apr 2014 01:21:05 +0200 |
parents | 0a14fc2d121e |
children | ddb803517a48 |
line wrap: on
line diff
--- a/mm7_6.cpp Tue Apr 01 23:44:27 2014 +0200 +++ b/mm7_6.cpp Wed Apr 02 01:21:05 2014 +0200 @@ -1,27 +1,9 @@ #define _CRT_SECURE_NO_WARNINGS -#include "MM7.h" - -#include "Weather.h" -#include "Sprites.h" -#include "Mouse.h" -#include "Keyboard.h" #include "Vis.h" #include "Game.h" -#include "GUIWindow.h" -#include "Party.h" -#include "AudioPlayer.h" -#include "Outdoor.h" +#include "MM7_data.h" #include "Actor.h" -#include "Viewport.h" -#include "OurMath.h" -#include "SpriteObject.h" -#include "ObjectList.h" -#include "Timer.h" -#include "IconFrameTable.h" -#include "TurnEngine.h" -#include "CastSpellInfo.h" -#include "stru298.h" @@ -48,187 +30,7 @@ return result; } -//----- (0042EB8D) -------------------------------------------------------- -void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) -{ - //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); - if (uNumMessages < 40) - { - files[uNumMessages] = file; - lines[uNumMessages] = line; - pMessages[uNumMessages].eType = msg; - pMessages[uNumMessages].param = param; - pMessages[uNumMessages++].field_8 = a4; - } -} - -//----- (0042EBDB) -------------------------------------------------------- -int stru193_math::Sin(int angle) -{ - return Cos(angle - this->uIntegerHalfPi); -} - -//----- (0042ECB5) -------------------------------------------------------- -void _42ECB5_PlayerAttacksActor() -{ - char *v5; // eax@8 - unsigned int v9; // ecx@21 - char *v11; // eax@26 - unsigned int v12; // eax@47 - SoundID v24; // [sp-4h] [bp-40h]@58 - - //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); - Player* player = &pParty->pPlayers[uActiveCharacter - 1]; - if (!player->CanAct()) - return; - - CastSpellInfoHelpers::_427D48(); - //v3 = 0; - if (pParty->Invisible()) - pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); - - //v31 = player->pEquipment.uBow; - int bow_idx = player->pEquipment.uBow; - if (bow_idx && player->pInventoryItemList[bow_idx - 1].IsBroken()) - bow_idx = 0; - - //v32 = 0; - int wand_item_id = 0; - //v33 = 0; - //v4 = v1->pEquipment.uMainHand; - int laser_weapon_item_id = 0; - - int main_hand_idx = player->pEquipment.uMainHand; - if (main_hand_idx) - { - ItemGen* item = &player->pInventoryItemList[main_hand_idx - 1]; - //v5 = (char *)v1 + 36 * v4; - if (!item->IsBroken()) - { - //v28b = &v1->pInventoryItems[v4].uItemID; - //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); - if (item->GetItemEquipType() == EQUIP_WAND) - { - if (item->uNumCharges <= 0) - player->pEquipment.uMainHand = 0; // wand discharged - unequip - else - wand_item_id = item->uItemID;//*((int *)v5 + 124); - } - else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE) - laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124); - } - } - - //v30 = 0; - //v29 = 0; - //v28 = 0; - //v7 = pMouse->uPointingObjectID; - - int target_pid = pMouse->uPointingObjectID; - int target_type = PID_TYPE(target_pid), - target_id = PID_ID(target_pid); - if (target_type != OBJECT_Actor || !pActors[target_id].CanAct()) - { - target_pid = stru_50C198.FindClosestActor(5120, 0, 0); - target_type = PID_TYPE(target_pid); - target_id = PID_ID(target_pid); - } - - Actor* actor = &pActors[target_id]; - int actor_distance = 0; - if (target_type == OBJECT_Actor) - { - int distance_x = actor->vPosition.x - pParty->vPosition.x, - distance_y = actor->vPosition.y - pParty->vPosition.y, - distance_z = actor->vPosition.z - pParty->vPosition.z; - actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius; - if (actor_distance < 0) - actor_distance = 0; - } - - bool shooting_bow = false, - shotting_laser = false, - shooting_wand = false, - melee_attack = false; - if (laser_weapon_item_id) - { - shotting_laser = true; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8); - } - else if (wand_item_id) - { - shooting_wand = true; - - int main_hand_idx = player->pEquipment.uMainHand; - _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); - - if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges) - player->pEquipment.uMainHand = 0; - } - else if (target_type == OBJECT_Actor && actor_distance <= 407.2) - { - melee_attack = true; - - Vec3_int_ a3; - a3.x = actor->vPosition.x - pParty->vPosition.x; - a3.y = actor->vPosition.y - pParty->vPosition.y; - a3.z = actor->vPosition.z - pParty->vPosition.z; - Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); - - DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); - if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED)) - _42FA66_do_explosive_impact(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter); - } - else if (bow_idx) - { - shooting_bow = true; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); - } - else - { - melee_attack = true; - ; // actor out of range or no actor; no ranged weapon so melee attacking air - } - - if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect - { - int recovery = player->GetAttackRecoveryTime(false); - if (recovery < 30 ) - recovery = 30; - player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); - } - - int v34 = 0; - if (shooting_wand) - return; - else if (shooting_bow) - { - v34 = 5; - player->PlaySound(SPEECH_50, 0); - } - if (shotting_laser) - v34 = 7; - else - { - int main_hand_idx = player->pEquipment.uMainHand; - if (player->HasItemEquipped(EQUIP_TWO_HANDED)) - v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType(); - pTurnEngine->ApplyPlayerAction(); - } - - switch (v34) - { - case 0: pAudioPlayer->PlaySound(SOUND_81, 0, 0, -1, 0, 0, 0, 0); break; - case 1: pAudioPlayer->PlaySound(SOUND_84, 0, 0, -1, 0, 0, 0, 0); break; - case 2: pAudioPlayer->PlaySound(SOUND_85, 0, 0, -1, 0, 0, 0, 0); break; - case 3: pAudioPlayer->PlaySound(SOUND_78, 0, 0, -1, 0, 0, 0, 0); break; - case 4: pAudioPlayer->PlaySound(SOUND_80, 0, 0, -1, 0, 0, 0, 0); break; - case 5: pAudioPlayer->PlaySound(SOUND_71, 0, 0, -1, 0, 0, 0, 0); break; - case 6: pAudioPlayer->PlaySound(SOUND_83, 0, 0, -1, 0, 0, 0, 0); break; - case 7: pAudioPlayer->PlaySound(SOUND_67, 0, 0, -1, 0, 0, 0, 0); break; - } -} //----- (0042F184) -------------------------------------------------------- int stru319::FindClosestActor(int pick_depth, int a3, int a4) @@ -380,569 +182,5 @@ return 0;*/ } -//----- (0042F3D6) -------------------------------------------------------- -void InitializeTurnBasedAnimations(void *_this) -{ - for (unsigned int i = 0; i < pIconIDs_Turn.size(); ++i) - { - char icon_name[32]; - sprintf(icon_name, "turn%u", i); - pIconIDs_Turn[i] = pIconsFrameTable->FindIcon(icon_name); - pIconsFrameTable->InitializeAnimation(pIconIDs_Turn[i]); - } - - uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); - uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); - uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); - uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); - uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); - - pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); - pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); - pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); - pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); -} - -//----- (0042F7EB) -------------------------------------------------------- -bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) -{ - unsigned __int16 pObjectDescID; // ax@7 - SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1 - - pSpellObject.stru_24.Reset(); - if ( a9 ) - memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24)); - pSpellObject.spell_skill = 0; - pSpellObject.spell_level = 0; - pSpellObject.spell_id = 0; - pSpellObject.field_54 = 0; - pSpellObject.uType = uSpriteID; - pObjectDescID = 0; - for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) - { - if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) - pObjectDescID = i; - } - pSpellObject.uObjectDescID = pObjectDescID; - pSpellObject.vPosition.x = x; - pSpellObject.vPosition.y = y; - pSpellObject.vPosition.z = z; - pSpellObject.uSoundID = 0; - pSpellObject.uAttributes = attributes; - pSpellObject.uSectorID = pIndoor->GetSector(x, y, z); - pSpellObject.uSpriteFrameID = 0; - pSpellObject.spell_caster_pid = 0; - pSpellObject.spell_target_pid = 0; - if ( !(pSpellObject.uAttributes & 0x10) ) - { - if ( pItemsTable->uAllItemsCount ) - { - for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i ) - { - if ( pItemsTable->pItems[i].uSpriteID == uSpriteID ) - pSpellObject.stru_24.uItemID = i; - } - } - } - if ( a7 ) - { - if ( count > 0 ) - { - for ( uint i = count; i; --i ) - { - pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; - pSpellObject.Create((signed __int16)pSpellObject.uFacing, - ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0); - - } - } - } - else - { - pSpellObject.uFacing = 0; - if ( count > 0 ) - { - for ( uint i = count; i; --i ) - { - pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0); - } - } - } - return true; -} - -//----- (0042F960) -------------------------------------------------------- -void __fastcall sub_42F960_create_object(int x, int y, int z) -{ - unsigned __int16 v7; // ax@5 - signed int v8; // eax@6 - signed int v9; // eax@7 - - SpriteObject a1; // [sp+Ch] [bp-70h]@1 - //SpriteObject::SpriteObject(&a1); - a1.stru_24.Reset(); - - a1.spell_skill = 0; - a1.spell_level = 0; - a1.spell_id = 0; - a1.field_54 = 0; - a1.uType = 800; - v7 = 0; - for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) - { - if ( a1.uType == pObjectList->pObjects[i].uObjectID ) - v7 = i; - } - a1.uObjectDescID = v7; - a1.vPosition.x = x; - a1.vPosition.y = y; - a1.vPosition.z = z; - a1.uSoundID = 0; - a1.uAttributes = 0; - a1.uSectorID = pIndoor->GetSector(x, y, z); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = 0; - a1.spell_target_pid = 0; - v8 = a1.Create(0, 0, 0, 0); - if ( v8 != -1 ) - { - v9 = 8 * v8; - LOBYTE(v9) = v9 | 2; - pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); - } -} - -//----- (0042FA66) -------------------------------------------------------- -void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) -{ - unsigned __int16 v9; // ax@5 - - SpriteObject a1a; // [sp+Ch] [bp-74h]@1 - //SpriteObject::SpriteObject(&a1a); - a1a.uType = 600; - a1a.stru_24.Reset(); - - a1a.spell_id = SPELL_FIRE_FIREBALL; - a1a.spell_level = 8; - a1a.spell_skill = 3; - v9 = 0; - for ( uint i = 0; i < pObjectList->uNumObjects; ++i ) - { - if ( a1a.uType == pObjectList->pObjects[i].uObjectID ) - v9 = i; - } - a1a.uObjectDescID = v9; - a1a.vPosition.x = a1; - a1a.vPosition.y = a2; - a1a.vPosition.z = a3; - a1a.uAttributes = 0; - a1a.uSectorID = pIndoor->GetSector(a1, a2, a3); - a1a.uSpriteFrameID = 0; - a1a.spell_target_pid = 0; - a1a.field_60_distance_related_prolly_lod = 0; - a1a.uFacing = 0; - a1a.uSoundID = 0; - if ( a6 >= 1 || a6 <= 4 ) - a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); - else - a1a.spell_caster_pid = 0; - - int id = a1a.Create(0, 0, 0, 0); - if (id != -1) - AttackerInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y), - SLOWORD(a1a.vPosition.z), 0, 0); -} - -//----- (0042FBDD) -------------------------------------------------------- -void sub_42FBDD() -{ - pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]); - pRenderer->Present(); -} - -//----- (0042FC15) -------------------------------------------------------- -void CloseWindowBackground() -{ - pAudioPlayer->PlaySound(SOUND_Button2, -2, 0, -1, 0, 0, 0, 0); - pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]); - pRenderer->Present(); -} - -//----- (0042FC4E) -------------------------------------------------------- -void ProcessInputActions() -{ - char v4; // al@9 - //char v8; // bl@100 - unsigned __int16 v9; // ax@102 - int spell_price; // eax@103 - char v14; // al@159 - unsigned int v15; // eax@168 - PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 - InputAction inputAction; // [sp+0h] [bp-8h]@7 - //int v24; // [sp+4h] [bp-4h]@87 - - pGame->pKeyboardInstance->EnterCriticalSection(); - Keyboard* pKeyboard = pGame->pKeyboardInstance; - if (!bAlwaysRun) - { - if (pKeyboard->IsShiftHeld()) - pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; - else - pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; - } - else - { - if (pKeyboard->IsShiftHeld()) - pParty->uFlags2 &= ~PARTY_FLAGS_2_RUNNING; - else - pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; - } - - //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; - // WUT? double event trigger - /*for ( uint i = 0; i < 30; ++i ) - { - if ( pKeyActionMap->pToggleTypes[i] ) - v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); - else - v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); - if ( v14 ) - { - if (pCurrentScreen == SCREEN_GAME) - { - pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); - continue; - } - if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) - { - v15 = pMessageQueue_50CBD0->uNumMessages; - if ( pMessageQueue_50CBD0->uNumMessages ) - { - v15 = 0; - if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) - { - v15 = 1; - pMessageQueue_50CBD0->uNumMessages = 0; - pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - continue; - } - pMessageQueue_50CBD0->uNumMessages = 0; - } - //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - } - } - }*/ - if ( !pEventTimer->bPaused ) - { - for ( uint i = 0; i < 30; ++i ) - { - inputAction = (InputAction)i; - if ( pKeyActionMap->pToggleTypes[inputAction] ) - v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[inputAction]); - else - v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[inputAction]); - if ( v4 ) - { - switch ( inputAction ) - { - case INPUT_MoveForward: - if (pCurrentScreen != SCREEN_GAME) - break; - if (!pParty->bTurnBasedModeOn) - { - if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) - partyAction = PARTY_RunForward; - else - partyAction = PARTY_WalkForward; - pPartyActionQueue->Add(partyAction); - break; - } - if (pTurnEngine->turn_stage != TE_WAIT && pTurnEngine->turn_stage != TE_ATTACK && pTurnEngine->uActionPointsLeft > 0 ) - { - pTurnEngine->uActionPointsLeft -= 26; - if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) - partyAction = PARTY_RunForward; - else - partyAction = PARTY_WalkForward; - pPartyActionQueue->Add(partyAction); - break; - } - break; - case INPUT_MoveBackwards: - if (pCurrentScreen != SCREEN_GAME) - break; - if (!pParty->bTurnBasedModeOn) - { - if ( pParty->uFlags2 & 2 ) - partyAction = PARTY_RunBackward; - else - partyAction = PARTY_WalkBackward; - pPartyActionQueue->Add(partyAction); - break; - } - if ( pTurnEngine->turn_stage != TE_WAIT && pTurnEngine->turn_stage != TE_ATTACK && pTurnEngine->uActionPointsLeft > 0 ) - { - pTurnEngine->uActionPointsLeft -= 26; - if ( pParty->uFlags2 & 2 ) - partyAction = PARTY_RunBackward; - else - partyAction = PARTY_WalkBackward; - pPartyActionQueue->Add(partyAction); - break; - } - break; - case INPUT_StrafeLeft: - if (pCurrentScreen != SCREEN_GAME) - break; - if (!pParty->bTurnBasedModeOn) - { - partyAction = PARTY_StrafeLeft; - pPartyActionQueue->Add(partyAction); - break; - } - if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->uActionPointsLeft <= 0 ) - break; - pTurnEngine->uActionPointsLeft -= 26; - partyAction = PARTY_StrafeLeft; - pPartyActionQueue->Add(partyAction); - break; - case INPUT_StrafeRight: - if (pCurrentScreen != SCREEN_GAME) - break; - if (!pParty->bTurnBasedModeOn) - { - partyAction = PARTY_StrafeRight; - pPartyActionQueue->Add(partyAction); - break; - } - if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->uActionPointsLeft <= 0 ) - break; - pTurnEngine->uActionPointsLeft -= 26; - partyAction = PARTY_StrafeRight; - pPartyActionQueue->Add(partyAction); - break; - case INPUT_TurnLeft: - if (pCurrentScreen != SCREEN_GAME) - break; - if ( GetAsyncKeyState(VK_CONTROL) ) // strafing - { - if (pParty->bTurnBasedModeOn) - { - if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->uActionPointsLeft <= 0 ) - break; - pTurnEngine->uActionPointsLeft -= 26; - } - partyAction = PARTY_StrafeLeft; - } - else - { - if ( pParty->uFlags2 & 2 ) - partyAction = PARTY_FastTurnLeft; - else - partyAction = PARTY_TurnLeft; - } - pPartyActionQueue->Add(partyAction); - if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) - pWeather->OnPlayerTurn(10); - break; - case INPUT_TurnRight: - if (pCurrentScreen != SCREEN_GAME) - break; - if ( GetAsyncKeyState(17) ) // strafing - { - if (pParty->bTurnBasedModeOn) - { - if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_ATTACK || pTurnEngine->uActionPointsLeft <= 0 ) - break; - pTurnEngine->uActionPointsLeft -= 26; - } - partyAction = PARTY_StrafeRight; - } - else - { - if ( pParty->uFlags2 & 2 ) - partyAction = PARTY_FastTurnRight; - else - partyAction = PARTY_TurnRight; - } - pPartyActionQueue->Add(partyAction); - if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) - pWeather->OnPlayerTurn(-10); - break; - case INPUT_Jump: - if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) - break; - partyAction = (PartyAction)12; - pPartyActionQueue->Add(partyAction); - break; - case INPUT_Yell: - if (!pCurrentScreen && uActiveCharacter) - { - pParty->Yell(); - pPlayers[uActiveCharacter]->PlaySound(SPEECH_Yell, 0); - } - break; - case INPUT_Pass: - if ( pCurrentScreen ) - break; - if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == TE_MOVEMENT) - { - pTurnEngine->field_18 |= TE_FLAG_8; - break; - } - if ( uActiveCharacter ) - { - if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) - { - if ( !pParty->bTurnBasedModeOn ) - pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false) * 2.133333333333333)); - CastSpellInfoHelpers::_427D48(); - pTurnEngine->ApplyPlayerAction(); - } - } - break; - case INPUT_Combat://if press ENTER - if (pCurrentScreen == SCREEN_GAME) - { - if (pParty->bTurnBasedModeOn) - { - if (pTurnEngine->turn_stage == TE_MOVEMENT || PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) - { - pParty->bTurnBasedModeOn = 0; - pTurnEngine->End(true); - } - } - else - { - pTurnEngine->Start(); - pParty->bTurnBasedModeOn = true; - } - } - break; - case INPUT_CastReady: - if (pCurrentScreen != SCREEN_GAME) - break; - if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == TE_MOVEMENT) - { - pTurnEngine->field_18 |= TE_FLAG_8; - break; - } - if ( !uActiveCharacter ) - break; - v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 + 12]; - if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater - || (( !(HIBYTE(v9) & 1)) ? - ((v9 & 0x80) == 0 ? - ((v9 & 0x40) == 0 ? spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uNormalLevelMana : spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uExpertLevelMana) : - spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMasterLevelMana) : - spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMagisterLevelMana, - spell_price > pPlayers[uActiveCharacter]->sMana) ) - { - pPartyActionQueue = pPartyActionQueue; - pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); - break; - } - else - pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); - break; - case INPUT_Attack: - if (pCurrentScreen != SCREEN_GAME) - break; - if (pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == TE_MOVEMENT) - { - pTurnEngine->field_18 |= TE_FLAG_8; - break; - } - pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); - break; - case INPUT_EventTrigger: - if (pCurrentScreen == SCREEN_GAME) - { - pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); - break; - } - if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) - { - if ( pMessageQueue_50CBD0->uNumMessages ) - { - pMessageQueue_50CBD0->uNumMessages = 0; - if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) - { - pMessageQueue_50CBD0->uNumMessages = 1; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 = 0; - ++pMessageQueue_50CBD0->uNumMessages; - break; - } - break; - } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - } - break; - case INPUT_CharCycle: - if ( pCurrentScreen == SCREEN_SPELL_BOOK ) - break; - - pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0); - break; - case INPUT_LookUp: - if ( pEventTimer->bPaused ) - break; - partyAction = (PartyAction)7; - pPartyActionQueue->Add(partyAction); - break; - case INPUT_CenterView: - if ( pEventTimer->bPaused ) - break; - partyAction = (PartyAction)9; - pPartyActionQueue->Add(partyAction); - break; - case INPUT_LookDown: - if ( pEventTimer->bPaused ) - break; - partyAction = (PartyAction)8; - pPartyActionQueue->Add(partyAction); - break; - case INPUT_FlyUp: - if ( pCurrentScreen || pEventTimer->bPaused ) - break; - partyAction = (PartyAction)13; - pPartyActionQueue->Add(partyAction); - break; - case INPUT_Land: - if ( pCurrentScreen || pEventTimer->bPaused ) - break; - partyAction = (PartyAction)15; - pPartyActionQueue->Add(partyAction); - break; - case INPUT_FlyDown: - if ( !pCurrentScreen - && !pEventTimer->bPaused ) - { - partyAction = (PartyAction)14; - pPartyActionQueue->Add(partyAction); - } - break; - case INPUT_ZoomIn: - pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); - break; - case INPUT_ZoomOut: - pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); - break; - case INPUT_AlwaysRun: - bAlwaysRun = bAlwaysRun == 0; - break; - default: - break; - } - } - } - } -}