comparison Engine/Objects/Player.cpp @ 2541:a902abdfc7f2

1. Renamed class Game to class Engine. 2. Separated game logic as state of FSM from game logic as engine. 3. Found out that many UI screen initializers were optimized away, intially they all returned newly created window as separate object like it is done in CharacterUI_Initialize.
author a.parshin
date Sun, 10 May 2015 01:29:11 +0200
parents 1bcadc6dd203
children b6140dfeac27
comparison
equal deleted inserted replaced
2540:abc6a9d079b9 2541:a902abdfc7f2
1 #define _CRTDBG_MAP_ALLOC 1 #define _CRTDBG_MAP_ALLOC
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <crtdbg.h> 3 #include <crtdbg.h>
4 4
5 #define _CRT_SECURE_NO_WARNINGS 5 #define _CRT_SECURE_NO_WARNINGS
6
7 #include "Engine/Engine.h"
8
6 #include "stru6.h" 9 #include "stru6.h"
7
8 #include "../ErrorHandling.h"
9 10
10 #include "Player.h" 11 #include "Player.h"
11 #include "../Tables/PlayerFrameTable.h" 12 #include "../Tables/PlayerFrameTable.h"
12 #include "Media/Audio/AudioPlayer.h" 13 #include "Media/Audio/AudioPlayer.h"
13 #include "../Party.h" 14 #include "../Party.h"
14 #include "../LOD.h" 15 #include "../LOD.h"
15 #include "GUI/GUIWindow.h" 16 #include "GUI/GUIWindow.h"
16 #include "../Graphics/Viewport.h" 17 #include "../Graphics/Viewport.h"
17 #include "Actor.h" 18 #include "Actor.h"
18 #include "../Game.h"
19 #include "IO/Mouse.h" 19 #include "IO/Mouse.h"
20 #include "../TurnEngine/TurnEngine.h" 20 #include "../TurnEngine/TurnEngine.h"
21 #include "../Events.h" 21 #include "../Events.h"
22 #include "../Events2D.h" 22 #include "../Events2D.h"
23 #include "../Graphics/Outdoor.h" 23 #include "../Graphics/Outdoor.h"
27 #include "../texts.h" 27 #include "../texts.h"
28 28
29 #include "../stru123.h" 29 #include "../stru123.h"
30 #include "../stru298.h" 30 #include "../stru298.h"
31 #include "ObjectList.h" 31 #include "ObjectList.h"
32 #include "../MM7.h"
33 #include "SpriteObject.h" 32 #include "SpriteObject.h"
34 #include "../Graphics/DecalBuilder.h" 33 #include "../Graphics/DecalBuilder.h"
35 #include "../Spells/CastSpellInfo.h" 34 #include "../Spells/CastSpellInfo.h"
36 #include "../OurMath.h" 35 #include "../OurMath.h"
37 #include "..\..\GUI\UI\UIPartyCreation.h" 36 #include "..\..\GUI\UI\UIPartyCreation.h"
2312 switch ( attTypeCast ) 2311 switch ( attTypeCast )
2313 { 2312 {
2314 case SPECIAL_ATTACK_CURSE: 2313 case SPECIAL_ATTACK_CURSE:
2315 SetCondition(Condition_Cursed, 1); 2314 SetCondition(Condition_Cursed, 1);
2316 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0); 2315 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2317 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2316 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2318 return 1; 2317 return 1;
2319 break; 2318 break;
2320 case SPECIAL_ATTACK_WEAK: 2319 case SPECIAL_ATTACK_WEAK:
2321 SetCondition(Condition_Weak, 1); 2320 SetCondition(Condition_Weak, 1);
2322 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0); 2321 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2323 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2322 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2324 return 1; 2323 return 1;
2325 break; 2324 break;
2326 case SPECIAL_ATTACK_SLEEP: 2325 case SPECIAL_ATTACK_SLEEP:
2327 SetCondition(Condition_Sleep, 1); 2326 SetCondition(Condition_Sleep, 1);
2328 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0); 2327 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2329 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2328 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2330 return 1; 2329 return 1;
2331 break; 2330 break;
2332 case SPECIAL_ATTACK_DRUNK: 2331 case SPECIAL_ATTACK_DRUNK:
2333 SetCondition(Condition_Drunk, 1); 2332 SetCondition(Condition_Drunk, 1);
2334 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0); 2333 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2335 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2334 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2336 return 1; 2335 return 1;
2337 break; 2336 break;
2338 case SPECIAL_ATTACK_INSANE: 2337 case SPECIAL_ATTACK_INSANE:
2339 SetCondition(Condition_Insane, 1); 2338 SetCondition(Condition_Insane, 1);
2340 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0); 2339 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0);
2341 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2340 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2342 return 1; 2341 return 1;
2343 break; 2342 break;
2344 case SPECIAL_ATTACK_POISON_WEAK: 2343 case SPECIAL_ATTACK_POISON_WEAK:
2345 SetCondition(Condition_Poison_Weak, 1); 2344 SetCondition(Condition_Poison_Weak, 1);
2346 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0); 2345 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2347 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2346 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2348 return 1; 2347 return 1;
2349 break; 2348 break;
2350 case SPECIAL_ATTACK_POISON_MEDIUM: 2349 case SPECIAL_ATTACK_POISON_MEDIUM:
2351 SetCondition(Condition_Poison_Medium, 1); 2350 SetCondition(Condition_Poison_Medium, 1);
2352 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0); 2351 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2353 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2352 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2354 return 1; 2353 return 1;
2355 break; 2354 break;
2356 case SPECIAL_ATTACK_POISON_SEVERE: 2355 case SPECIAL_ATTACK_POISON_SEVERE:
2357 SetCondition(Condition_Poison_Severe, 1); 2356 SetCondition(Condition_Poison_Severe, 1);
2358 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0); 2357 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2359 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2358 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2360 return 1; 2359 return 1;
2361 break; 2360 break;
2362 case SPECIAL_ATTACK_DISEASE_WEAK: 2361 case SPECIAL_ATTACK_DISEASE_WEAK:
2363 SetCondition(Condition_Disease_Weak, 1); 2362 SetCondition(Condition_Disease_Weak, 1);
2364 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0); 2363 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2365 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2364 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2366 return 1; 2365 return 1;
2367 break; 2366 break;
2368 case SPECIAL_ATTACK_DISEASE_MEDIUM: 2367 case SPECIAL_ATTACK_DISEASE_MEDIUM:
2369 SetCondition(Condition_Disease_Medium, 1); 2368 SetCondition(Condition_Disease_Medium, 1);
2370 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0); 2369 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2371 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2370 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2372 return 1; 2371 return 1;
2373 break; 2372 break;
2374 case SPECIAL_ATTACK_DISEASE_SEVERE: 2373 case SPECIAL_ATTACK_DISEASE_SEVERE:
2375 SetCondition(Condition_Disease_Severe, 1); 2374 SetCondition(Condition_Disease_Severe, 1);
2376 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0); 2375 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2377 pGame->pStru6Instance->SetPlayerBuffAnim(0x99, v3); 2376 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2378 return 1; 2377 return 1;
2379 break; 2378 break;
2380 case SPECIAL_ATTACK_PARALYZED: 2379 case SPECIAL_ATTACK_PARALYZED:
2381 SetCondition(Condition_Paralyzed, 1); 2380 SetCondition(Condition_Paralyzed, 1);
2382 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0); 2381 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0);
2383 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2382 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2384 return 1; 2383 return 1;
2385 break; 2384 break;
2386 case SPECIAL_ATTACK_UNCONSCIOUS: 2385 case SPECIAL_ATTACK_UNCONSCIOUS:
2387 SetCondition(Condition_Unconcious, 1); 2386 SetCondition(Condition_Unconcious, 1);
2388 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0); 2387 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0);
2389 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2388 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2390 return 1; 2389 return 1;
2391 break; 2390 break;
2392 case SPECIAL_ATTACK_DEAD: 2391 case SPECIAL_ATTACK_DEAD:
2393 SetCondition(Condition_Dead, 1); 2392 SetCondition(Condition_Dead, 1);
2394 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0); 2393 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0);
2395 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2394 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2396 return 1; 2395 return 1;
2397 break; 2396 break;
2398 case SPECIAL_ATTACK_PETRIFIED: 2397 case SPECIAL_ATTACK_PETRIFIED:
2399 SetCondition(Condition_Pertified, 1); 2398 SetCondition(Condition_Pertified, 1);
2400 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0); 2399 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0);
2401 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2400 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2402 return 1; 2401 return 1;
2403 break; 2402 break;
2404 case SPECIAL_ATTACK_ERADICATED: 2403 case SPECIAL_ATTACK_ERADICATED:
2405 SetCondition(Condition_Eradicated, 1); 2404 SetCondition(Condition_Eradicated, 1);
2406 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0); 2405 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0);
2407 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2406 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2408 return 1; 2407 return 1;
2409 break; 2408 break;
2410 case SPECIAL_ATTACK_BREAK_ANY: 2409 case SPECIAL_ATTACK_BREAK_ANY:
2411 case SPECIAL_ATTACK_BREAK_ARMOR: 2410 case SPECIAL_ATTACK_BREAK_ARMOR:
2412 case SPECIAL_ATTACK_BREAK_WEAPON: 2411 case SPECIAL_ATTACK_BREAK_WEAPON:
2414 { 2413 {
2415 PlaySound(SPEECH_40, 0); 2414 PlaySound(SPEECH_40, 0);
2416 v48->SetBroken(); 2415 v48->SetBroken();
2417 pAudioPlayer->PlaySound(SOUND_metal_vs_metal03h, 0, 0, -1, 0, 0, 0, 0); 2416 pAudioPlayer->PlaySound(SOUND_metal_vs_metal03h, 0, 0, -1, 0, 0, 0, 0);
2418 } 2417 }
2419 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2418 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2420 return 1; 2419 return 1;
2421 break; 2420 break;
2422 case SPECIAL_ATTACK_STEAL: 2421 case SPECIAL_ATTACK_STEAL:
2423 PlaySound(SPEECH_40, 0); 2422 PlaySound(SPEECH_40, 0);
2424 v27 = pActor->ActorHasItems; 2423 v27 = pActor->ActorHasItems;
2425 if ( pActor->ActorHasItems[0].uItemID ) 2424 if ( pActor->ActorHasItems[0].uItemID )
2426 { 2425 {
2427 v27 = &pActor->ActorHasItems[1]; 2426 v27 = &pActor->ActorHasItems[1];
2428 if ( pActor->ActorHasItems[1].uItemID ) 2427 if ( pActor->ActorHasItems[1].uItemID )
2429 { 2428 {
2430 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2429 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2431 return 1; 2430 return 1;
2432 } 2431 }
2433 } 2432 }
2434 memcpy(v27, &this->pInventoryItemList[this->pInventoryMatrix[v47]-1], 0x24u); 2433 memcpy(v27, &this->pInventoryItemList[this->pInventoryMatrix[v47]-1], 0x24u);
2435 RemoveItemAtInventoryIndex(v47); 2434 RemoveItemAtInventoryIndex(v47);
2436 pAudioPlayer->PlaySound(SOUND_metal_vs_metal03h, 0, 0, -1, 0, 0, 0, 0); 2435 pAudioPlayer->PlaySound(SOUND_metal_vs_metal03h, 0, 0, -1, 0, 0, 0, 0);
2437 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2436 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2438 return 1; 2437 return 1;
2439 break; 2438 break;
2440 case SPECIAL_ATTACK_AGING: 2439 case SPECIAL_ATTACK_AGING:
2441 PlaySound(SPEECH_42, 0); 2440 PlaySound(SPEECH_42, 0);
2442 ++this->sAgeModifier; 2441 ++this->sAgeModifier;
2443 pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0, 0, 0); 2442 pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0, 0, 0);
2444 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2443 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2445 return 1; 2444 return 1;
2446 break; 2445 break;
2447 case SPECIAL_ATTACK_MANA_DRAIN: 2446 case SPECIAL_ATTACK_MANA_DRAIN:
2448 PlaySound(SPEECH_41, 0); 2447 PlaySound(SPEECH_41, 0);
2449 this->sMana = 0; 2448 this->sMana = 0;
2450 pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0, 0, 0); 2449 pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0, 0, 0);
2451 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2450 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2452 return 1; 2451 return 1;
2453 break; 2452 break;
2454 case SPECIAL_ATTACK_FEAR: 2453 case SPECIAL_ATTACK_FEAR:
2455 SetCondition(Condition_Fear, 1); 2454 SetCondition(Condition_Fear, 1);
2456 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0); 2455 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2457 pGame->pStru6Instance->SetPlayerBuffAnim(0x99u, v3); 2456 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2458 return 1; 2457 return 1;
2459 break; 2458 break;
2460 default: 2459 default:
2461 return 0; 2460 return 0;
2462 } 2461 }
4645 } 4644 }
4646 4645
4647 4646
4648 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_SPELL_SCROLL ) 4647 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_SPELL_SCROLL )
4649 { 4648 {
4650 if ( pCurrentScreen == SCREEN_CASTING ) 4649 if ( current_screen_type == SCREEN_CASTING )
4651 return; 4650 return;
4652 if ( !playerAffected->CanAct() ) 4651 if ( !playerAffected->CanAct() )
4653 { 4652 {
4654 4653
4655 v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()]; 4654 v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
4669 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura 4668 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
4670 { 4669 {
4671 pMouse->RemoveHoldingItem(); 4670 pMouse->RemoveHoldingItem();
4672 pGUIWindow_CurrentMenu->Release(); 4671 pGUIWindow_CurrentMenu->Release();
4673 pIcons_LOD->RemoveTexturesPackFromTextureList(); 4672 pIcons_LOD->RemoveTexturesPackFromTextureList();
4674 pCurrentScreen = SCREEN_GAME; 4673 current_screen_type = SCREEN_GAME;
4675 viewparams->bRedrawGameUI = 1; 4674 viewparams->bRedrawGameUI = 1;
4676 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0); 4675 _42777D_CastSpell_UseWand_ShootArrow(scroll_id, player_num - 1, 0x85u, 1, 0);
4677 } 4676 }
4678 else 4677 else
4679 { 4678 {
4680 pMouse->RemoveHoldingItem(); 4679 pMouse->RemoveHoldingItem();
4681 pMessageQueue_50C9E8->AddGUIMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1); 4680 pMessageQueue_50C9E8->AddGUIMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
4682 if ( pCurrentScreen && pGUIWindow_CurrentMenu 4681 if ( current_screen_type && pGUIWindow_CurrentMenu
4683 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)) 4682 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null))
4684 { 4683 {
4685 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); 4684 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
4686 } 4685 }
4687 } 4686 }
4864 break; 4863 break;
4865 4864
4866 } 4865 }
4867 ShowStatusBarString(pTmpBuf.data(), 2); 4866 ShowStatusBarString(pTmpBuf.data(), 2);
4868 pMouse->RemoveHoldingItem(); 4867 pMouse->RemoveHoldingItem();
4869 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); 4868 pEngine->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
4870 playerAffected->PlaySound(SPEECH_93, 0); 4869 playerAffected->PlaySound(SPEECH_93, 0);
4871 pAudioPlayer->PlaySound(SOUND_chimes, 0, 0, -1, 0, 0, 0, 0); 4870 pAudioPlayer->PlaySound(SOUND_chimes, 0, 0, -1, 0, 0, 0, 0);
4872 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) 4871 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
4873 { 4872 {
4874 playerAffected->SetCondition(Condition_Eradicated, 0); 4873 playerAffected->SetCondition(Condition_Eradicated, 0);
4906 pAudioPlayer->PlaySound(SOUND_trumpet, 0, 0, -1, 0, 0, 0, 0); 4905 pAudioPlayer->PlaySound(SOUND_trumpet, 0, 0, -1, 0, 0, 0, 0);
4907 return; 4906 return;
4908 } 4907 }
4909 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe 4908 else if ( pParty->pPickedItem.uItemID == 646 ) //Horseshoe
4910 { 4909 {
4911 pGame->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1); 4910 pEngine->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
4912 v5 = PID(OBJECT_Player, player_num + 49); 4911 v5 = PID(OBJECT_Player, player_num + 49);
4913 pAudioPlayer->PlaySound(SOUND_quest, v5, 0, -1, 0, 0, 0, 0); 4912 pAudioPlayer->PlaySound(SOUND_quest, v5, 0, -1, 0, 0, 0, 0);
4914 playerAffected->AddVariable(VAR_NumSkillPoints, 2); 4913 playerAffected->AddVariable(VAR_NumSkillPoints, 2);
4915 } 4914 }
4916 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle 4915 else if ( pParty->pPickedItem.uItemID == 650 ) //Temple in a Bottle
5476 return; 5475 return;
5477 case VAR_QBits_QuestsDone: 5476 case VAR_QBits_QuestsDone:
5478 if ( !_449B57_test_bit(pParty->_quest_bits, var_value) && pQuestTable[var_value-1] ) 5477 if ( !_449B57_test_bit(pParty->_quest_bits, var_value) && pQuestTable[var_value-1] )
5479 { 5478 {
5480 bFlashQuestBook = 1; 5479 bFlashQuestBook = 1;
5481 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex()); 5480 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex());
5482 PlayAwardSound(); 5481 PlayAwardSound();
5483 this->PlaySound(SPEECH_93, 0); 5482 this->PlaySound(SPEECH_93, 0);
5484 } 5483 }
5485 _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u); 5484 _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u);
5486 return; 5485 return;
5733 PlayAwardSound_Anim(); 5732 PlayAwardSound_Anim();
5734 return; 5733 return;
5735 case VAR_AutoNotes: 5734 case VAR_AutoNotes:
5736 if ( !_449B57_test_bit(pParty->_autonote_bits, var_value) && pAutonoteTxt[var_value-1].pText ) 5735 if ( !_449B57_test_bit(pParty->_autonote_bits, var_value) && pAutonoteTxt[var_value-1].pText )
5737 { 5736 {
5738 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex()); 5737 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex());
5739 this->PlaySound(SPEECH_96, 0); 5738 this->PlaySound(SPEECH_96, 0);
5740 bFlashAutonotesBook = 1; 5739 bFlashAutonotesBook = 1;
5741 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; 5740 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
5742 } 5741 }
5743 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); 5742 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u);
5925 5924
5926 //----- (new function) -------------------------------------------------------- 5925 //----- (new function) --------------------------------------------------------
5927 void Player::PlayAwardSound_Anim() 5926 void Player::PlayAwardSound_Anim()
5928 { 5927 {
5929 int playerIndex = GetPlayerIndex(); 5928 int playerIndex = GetPlayerIndex();
5930 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex); 5929 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex);
5931 PlayAwardSound(); 5930 PlayAwardSound();
5932 } 5931 }
5933 5932
5934 //----- (new function) -------------------------------------------------------- 5933 //----- (new function) --------------------------------------------------------
5935 void Player::PlayAwardSound_Anim_Face( PlayerSpeech speech ) 5934 void Player::PlayAwardSound_Anim_Face( PlayerSpeech speech )
5949 else 5948 else
5950 { 5949 {
5951 this->*skillToSet = skillValue | currSkillValue & 0xC0; 5950 this->*skillToSet = skillValue | currSkillValue & 0xC0;
5952 } 5951 }
5953 int playerIndex = GetPlayerIndex(); 5952 int playerIndex = GetPlayerIndex();
5954 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex); 5953 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex);
5955 PlayAwardSound(); 5954 PlayAwardSound();
5956 } 5955 }
5957 5956
5958 //----- (0044AFFB) -------------------------------------------------------- 5957 //----- (0044AFFB) --------------------------------------------------------
5959 void Player::AddVariable(enum VariableType var_type, signed int val) 5958 void Player::AddVariable(enum VariableType var_type, signed int val)
6332 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText ) 6331 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText )
6333 { 6332 {
6334 this->PlaySound(SPEECH_96, 0); 6333 this->PlaySound(SPEECH_96, 0);
6335 bFlashAutonotesBook = 1; 6334 bFlashAutonotesBook = 1;
6336 _506568_autonote_type = pAutonoteTxt[val].eType; 6335 _506568_autonote_type = pAutonoteTxt[val].eType;
6337 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, GetPlayerIndex()); 6336 pEngine->pStru6Instance->SetPlayerBuffAnim(0x97u, GetPlayerIndex());
6338 } 6337 }
6339 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1); 6338 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1);
6340 PlayAwardSound(); 6339 PlayAwardSound();
6341 return; 6340 return;
6342 case VAR_PlayerBits: 6341 case VAR_PlayerBits:
6501 6500
6502 //----- (new function) -------------------------------------------------------- 6501 //----- (new function) --------------------------------------------------------
6503 void Player::PlayAwardSound_Anim97() 6502 void Player::PlayAwardSound_Anim97()
6504 { 6503 {
6505 int playerIndex = GetPlayerIndex(); 6504 int playerIndex = GetPlayerIndex();
6506 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, playerIndex); 6505 pEngine->pStru6Instance->SetPlayerBuffAnim(0x97u, playerIndex);
6507 PlayAwardSound(); 6506 PlayAwardSound();
6508 } 6507 }
6509 6508
6510 //----- (new function) -------------------------------------------------------- 6509 //----- (new function) --------------------------------------------------------
6511 void Player::PlayAwardSound_Anim97_Face( PlayerSpeech speech ) 6510 void Player::PlayAwardSound_Anim97_Face( PlayerSpeech speech )
7095 7094
7096 //----- (new function) -------------------------------------------------------- 7095 //----- (new function) --------------------------------------------------------
7097 void Player::PlayAwardSound_Anim98() 7096 void Player::PlayAwardSound_Anim98()
7098 { 7097 {
7099 int playerIndex = GetPlayerIndex(); 7098 int playerIndex = GetPlayerIndex();
7100 pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, playerIndex); 7099 pEngine->pStru6Instance->SetPlayerBuffAnim(0x98u, playerIndex);
7101 PlayAwardSound(); 7100 PlayAwardSound();
7102 } 7101 }
7103 7102
7104 //----- (new function) -------------------------------------------------------- 7103 //----- (new function) --------------------------------------------------------
7105 void Player::PlayAwardSound_Anim98_Face( PlayerSpeech speech ) 7104 void Player::PlayAwardSound_Anim98_Face( PlayerSpeech speech )
7341 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); //todo extract this branch to a function once Actor::functions are changed to nonstatic actor functions 7340 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); //todo extract this branch to a function once Actor::functions are changed to nonstatic actor functions
7342 Actor::AggroSurroundingPeasants(uActorID, 1); 7341 Actor::AggroSurroundingPeasants(uActorID, 1);
7343 } 7342 }
7344 else 7343 else
7345 { 7344 {
7346 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS) 7345 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pEngine->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS)
7347 { 7346 {
7348 int splatRadius = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius; 7347 int splatRadius = byte_4D864C && BYTE2(pEngine->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
7349 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0); 7348 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0);
7350 } 7349 }
7351 Actor::Die(uActorID); 7350 Actor::Die(uActorID);
7352 Actor::ApplyFineForKillingPeasant(uActorID); 7351 Actor::ApplyFineForKillingPeasant(uActorID);
7353 Actor::AggroSurroundingPeasants(uActorID, 1); 7352 Actor::AggroSurroundingPeasants(uActorID, 1);
7533 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); 7532 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
7534 Actor::AggroSurroundingPeasants(uActorID, 1); 7533 Actor::AggroSurroundingPeasants(uActorID, 1);
7535 } 7534 }
7536 else 7535 else
7537 { 7536 {
7538 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) 7537 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pEngine->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
7539 { 7538 {
7540 int splatRadius = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius; 7539 int splatRadius = byte_4D864C && BYTE2(pEngine->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
7541 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0); 7540 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0);
7542 } 7541 }
7543 Actor::Die(uActorID); 7542 Actor::Die(uActorID);
7544 Actor::ApplyFineForKillingPeasant(uActorID); 7543 Actor::ApplyFineForKillingPeasant(uActorID);
7545 Actor::AggroSurroundingPeasants(uActorID, 1); 7544 Actor::AggroSurroundingPeasants(uActorID, 1);