Mercurial > mm7
comparison Actor.cpp @ 781:d170f23f70d1
tidy, code moving
author | zipi |
---|---|
date | Sun, 24 Mar 2013 01:27:34 +0000 |
parents | 7f1487b74571 |
children | c232f160e6f3 |
comparison
equal
deleted
inserted
replaced
780:93c6b78abf35 | 781:d170f23f70d1 |
---|---|
19 #include "LOD.h" | 19 #include "LOD.h" |
20 #include "Party.h" | 20 #include "Party.h" |
21 #include "GUIWindow.h" | 21 #include "GUIWindow.h" |
22 #include "GUIFont.h" | 22 #include "GUIFont.h" |
23 | 23 |
24 | |
25 | |
26 | |
27 Actor pActors[500]; | 24 Actor pActors[500]; |
28 int uNumActors; | 25 int uNumActors; |
29 | 26 |
30 stru319 stru_50C198; // idb | 27 stru319 stru_50C198; // idb |
31 | 28 |
32 | 29 //----- (00448A40) -------------------------------------------------------- |
33 | 30 void Actor::ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle) |
34 | 31 { |
32 if ( uActorID >= 0 && uActorID <= (signed int)(uNumActors - 1) ) | |
33 { | |
34 if ( bToggle ) | |
35 { | |
36 pActors[uActorID].uAttributes |= uFlag; | |
37 } | |
38 else | |
39 { | |
40 if ( uFlag == 0x10000 ) | |
41 { | |
42 if (pActors[uActorID].uAIState == Disabled ) | |
43 pActors[uActorID].uAIState = Standing; | |
44 } | |
45 pActors[uActorID].uAttributes &= ~uFlag; | |
46 } | |
47 } | |
48 } | |
35 | 49 |
36 //----- (00448518) -------------------------------------------------------- | 50 //----- (00448518) -------------------------------------------------------- |
37 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3) | 51 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3) |
38 { | 52 { |
39 signed int v3; // eax@1 | 53 signed int v3; // eax@1 |
139 v6->Reset(); | 153 v6->Reset(); |
140 } | 154 } |
141 } | 155 } |
142 } | 156 } |
143 } | 157 } |
144 | |
145 | 158 |
146 //----- (00445D4A) -------------------------------------------------------- | 159 //----- (00445D4A) -------------------------------------------------------- |
147 void Actor::InitializeDialogue(int bPlayerSaysHello) | 160 void Actor::InitializeDialogue(int bPlayerSaysHello) |
148 { | 161 { |
149 Actor *v2; // esi@1 | 162 Actor *v2; // esi@1 |
287 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0); | 300 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0); |
288 else | 301 else |
289 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0); | 302 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0); |
290 } | 303 } |
291 } | 304 } |
292 | |
293 | 305 |
294 //----- (0040894B) -------------------------------------------------------- | 306 //----- (0040894B) -------------------------------------------------------- |
295 bool Actor::CanAct() | 307 bool Actor::CanAct() |
296 { | 308 { |
297 signed int v1; // esi@1 | 309 signed int v1; // esi@1 |
1410 v22 = (SoundID)word_4EE088_sound_ids[93]; | 1422 v22 = (SoundID)word_4EE088_sound_ids[93]; |
1411 goto LABEL_202; | 1423 goto LABEL_202; |
1412 } | 1424 } |
1413 } | 1425 } |
1414 | 1426 |
1415 | |
1416 //----- (0043ABB0) -------------------------------------------------------- | 1427 //----- (0043ABB0) -------------------------------------------------------- |
1417 bool Actor::ArePeasantsOfSameFaction(Actor *a1, Actor *a2) | 1428 bool Actor::ArePeasantsOfSameFaction(Actor *a1, Actor *a2) |
1418 { | 1429 { |
1419 unsigned int v2; // esi@1 | 1430 unsigned int v2; // esi@1 |
1420 unsigned int v3; // edi@1 | 1431 unsigned int v3; // edi@1 |
1465 BYTE2(actor->uAttributes) |= 8u; | 1476 BYTE2(actor->uAttributes) |= 8u; |
1466 } | 1477 } |
1467 } | 1478 } |
1468 } | 1479 } |
1469 } | 1480 } |
1470 | |
1471 | 1481 |
1472 //----- (00404874) -------------------------------------------------------- | 1482 //----- (00404874) -------------------------------------------------------- |
1473 char __fastcall Actor::_404874(unsigned int uActorID, AIDirection *a2, int a3, char a4) | 1483 char __fastcall Actor::_404874(unsigned int uActorID, AIDirection *a2, int a3, char a4) |
1474 { | 1484 { |
1475 AIDirection *v4; // edi@1 | 1485 AIDirection *v4; // edi@1 |
1948 result = pOut; | 1958 result = pOut; |
1949 memcpy(pOut, &v41, 0x1Cu); | 1959 memcpy(pOut, &v41, 0x1Cu); |
1950 return result; | 1960 return result; |
1951 } | 1961 } |
1952 | 1962 |
1953 | |
1954 //----- (00404030) -------------------------------------------------------- | 1963 //----- (00404030) -------------------------------------------------------- |
1955 void Actor::FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) | 1964 void Actor::FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4) |
1956 { | 1965 { |
1957 unsigned int v4; // edi@1 | 1966 unsigned int v4; // edi@1 |
1958 unsigned int v5; // esi@1 | 1967 unsigned int v5; // esi@1 |
2000 if (rand() % 2) | 2009 if (rand() % 2) |
2001 AI_Bored(uActorID, uObjID, a4); | 2010 AI_Bored(uActorID, uObjID, a4); |
2002 else | 2011 else |
2003 AI_Stand(uActorID, uObjID, uActionLength, a4); | 2012 AI_Stand(uActorID, uObjID, uActionLength, a4); |
2004 } | 2013 } |
2005 | |
2006 | |
2007 | 2014 |
2008 //----- (00403EB6) -------------------------------------------------------- | 2015 //----- (00403EB6) -------------------------------------------------------- |
2009 void Actor::AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, AIDirection *a4) | 2016 void Actor::AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, AIDirection *a4) |
2010 { | 2017 { |
2011 assert(uActorID < uNumActors); | 2018 assert(uActorID < uNumActors); |
2026 actor->vVelocity.z = 0; | 2033 actor->vVelocity.z = 0; |
2027 actor->vVelocity.y = 0; | 2034 actor->vVelocity.y = 0; |
2028 actor->vVelocity.x = 0; | 2035 actor->vVelocity.x = 0; |
2029 actor->UpdateAnimation(); | 2036 actor->UpdateAnimation(); |
2030 } | 2037 } |
2031 | |
2032 | 2038 |
2033 //----- (00403E61) -------------------------------------------------------- | 2039 //----- (00403E61) -------------------------------------------------------- |
2034 void __fastcall Actor::StandAwhile(unsigned int uActorID) | 2040 void __fastcall Actor::StandAwhile(unsigned int uActorID) |
2035 { | 2041 { |
2036 Actor *v1; // esi@1 | 2042 Actor *v1; // esi@1 |
2146 } | 2152 } |
2147 else | 2153 else |
2148 Actor::_402AD7(v24, a2, rand() % 2, 64, arg0); | 2154 Actor::_402AD7(v24, a2, rand() % 2, 64, arg0); |
2149 } | 2155 } |
2150 | 2156 |
2151 | |
2152 //----- (00438CF3) -------------------------------------------------------- | 2157 //----- (00438CF3) -------------------------------------------------------- |
2153 void Actor::ApplyFineForKillingPeasant(unsigned int uActorID) | 2158 void Actor::ApplyFineForKillingPeasant(unsigned int uActorID) |
2154 { | 2159 { |
2155 unsigned int v1; // esi@1 | 2160 unsigned int v1; // esi@1 |
2156 unsigned int v2; // edi@2 | 2161 unsigned int v2; // edi@2 |
2213 ++ppPlayers; | 2218 ++ppPlayers; |
2214 } | 2219 } |
2215 while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] ); | 2220 while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] ); |
2216 } | 2221 } |
2217 } | 2222 } |
2218 | |
2219 | 2223 |
2220 //----- (0043AE80) -------------------------------------------------------- | 2224 //----- (0043AE80) -------------------------------------------------------- |
2221 void Actor::AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3) | 2225 void Actor::AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3) |
2222 { | 2226 { |
2223 int result; // eax@1 | 2227 int result; // eax@1 |
2324 return; | 2328 return; |
2325 } | 2329 } |
2326 return; | 2330 return; |
2327 } | 2331 } |
2328 | 2332 |
2329 | |
2330 //----- (0043B3E0) -------------------------------------------------------- | 2333 //----- (0043B3E0) -------------------------------------------------------- |
2331 int Actor::_43B3E0_CalcDamage(Actor *a1, signed int a2) | 2334 int Actor::_43B3E0_CalcDamage(Actor *a1, signed int a2) |
2332 { | 2335 { |
2333 signed int v2; // ebp@1 | 2336 signed int v2; // ebp@1 |
2334 int v3; // eax@9 | 2337 int v3; // eax@9 |
2450 pTurnEngine->_40471C(); | 2453 pTurnEngine->_40471C(); |
2451 result = 1; | 2454 result = 1; |
2452 } | 2455 } |
2453 return result; | 2456 return result; |
2454 } | 2457 } |
2455 | |
2456 | 2458 |
2457 //----- (00403A60) -------------------------------------------------------- | 2459 //----- (00403A60) -------------------------------------------------------- |
2458 void Actor::_403A60(unsigned int uActorID, signed int edx0, AIDirection *pDir) | 2460 void Actor::_403A60(unsigned int uActorID, signed int edx0, AIDirection *pDir) |
2459 { | 2461 { |
2460 Actor *v3; // ebx@1 | 2462 Actor *v3; // ebx@1 |
2558 } | 2560 } |
2559 else | 2561 else |
2560 Actor::_402AD7(v22, a2, v22, 64, pDir); | 2562 Actor::_402AD7(v22, a2, v22, 64, pDir); |
2561 } | 2563 } |
2562 | 2564 |
2563 | |
2564 //----- (00403854) -------------------------------------------------------- | 2565 //----- (00403854) -------------------------------------------------------- |
2565 void Actor::_403854(unsigned int uActorID, signed int edx0, AIDirection *pDir) | 2566 void Actor::_403854(unsigned int uActorID, signed int edx0, AIDirection *pDir) |
2566 { | 2567 { |
2567 Actor *v3; // ebx@1 | 2568 Actor *v3; // ebx@1 |
2568 AIDirection *v4; // esi@3 | 2569 AIDirection *v4; // esi@3 |
2665 } | 2666 } |
2666 else | 2667 else |
2667 Actor::_402AD7(v22, a2, v22, 64, pDir); | 2668 Actor::_402AD7(v22, a2, v22, 64, pDir); |
2668 } | 2669 } |
2669 | 2670 |
2670 | |
2671 //----- (0040368B) -------------------------------------------------------- | 2671 //----- (0040368B) -------------------------------------------------------- |
2672 void Actor::_40368B(unsigned int uActorID, signed int edx0, AIDirection *pDir) | 2672 void Actor::_40368B(unsigned int uActorID, signed int edx0, AIDirection *pDir) |
2673 { | 2673 { |
2674 Actor *v3; // ebx@1 | 2674 Actor *v3; // ebx@1 |
2675 AIDirection *v4; // esi@3 | 2675 AIDirection *v4; // esi@3 |
2756 v3->UpdateAnimation(); | 2756 v3->UpdateAnimation(); |
2757 } | 2757 } |
2758 else | 2758 else |
2759 Actor::_402AD7(v21, a2, v21, 64, pDir); | 2759 Actor::_402AD7(v21, a2, v21, 64, pDir); |
2760 } | 2760 } |
2761 | |
2762 | 2761 |
2763 //----- (00403476) -------------------------------------------------------- | 2762 //----- (00403476) -------------------------------------------------------- |
2764 void Actor::_403476(unsigned int uActorID, signed int edx0, AIDirection *pDir) | 2763 void Actor::_403476(unsigned int uActorID, signed int edx0, AIDirection *pDir) |
2765 { | 2764 { |
2766 Actor *v3; // ebx@1 | 2765 Actor *v3; // ebx@1 |
2940 if ( rand() % 100 < 2 ) | 2939 if ( rand() % 100 < 2 ) |
2941 Actor::PlaySound(uActorID, 3u); | 2940 Actor::PlaySound(uActorID, 3u); |
2942 v5->UpdateAnimation(); | 2941 v5->UpdateAnimation(); |
2943 } | 2942 } |
2944 | 2943 |
2945 | |
2946 //----- (004031C1) -------------------------------------------------------- | 2944 //----- (004031C1) -------------------------------------------------------- |
2947 char __fastcall Actor::_4031C1_update_job(unsigned int uActorID, signed int a2, int a3) | 2945 char __fastcall Actor::_4031C1_update_job(unsigned int uActorID, signed int a2, int a3) |
2948 { | 2946 { |
2949 unsigned int v3; // edi@1 | 2947 unsigned int v3; // edi@1 |
2950 Actor *v4; // esi@1 | 2948 Actor *v4; // esi@1 |
2998 } | 2996 } |
2999 } | 2997 } |
3000 } | 2998 } |
3001 return (char)v5; | 2999 return (char)v5; |
3002 } | 3000 } |
3003 | |
3004 | 3001 |
3005 //----- (004030AD) -------------------------------------------------------- | 3002 //----- (004030AD) -------------------------------------------------------- |
3006 void Actor::_4030AD(unsigned int uActorID, signed int edx0, int arg0) | 3003 void Actor::_4030AD(unsigned int uActorID, signed int edx0, int arg0) |
3007 { | 3004 { |
3008 unsigned int v3; // edi@1 | 3005 unsigned int v3; // edi@1 |
3102 pActor->uCurrentActionLength = 8 * v2[v3].uAnimLength; | 3099 pActor->uCurrentActionLength = 8 * v2[v3].uAnimLength; |
3103 pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP); | 3100 pActor->sCurrentHP = LOWORD(pActor->pMonsterInfo.uHP); |
3104 Actor::PlaySound(uActorID, 1u); | 3101 Actor::PlaySound(uActorID, 1u); |
3105 pActor->UpdateAnimation(); | 3102 pActor->UpdateAnimation(); |
3106 } | 3103 } |
3107 | |
3108 | 3104 |
3109 //----- (00402D6E) -------------------------------------------------------- | 3105 //----- (00402D6E) -------------------------------------------------------- |
3110 void Actor::Die(unsigned int uActorID) | 3106 void Actor::Die(unsigned int uActorID) |
3111 { | 3107 { |
3112 auto actor = &pActors[uActorID]; | 3108 auto actor = &pActors[uActorID]; |
3370 v5->UpdateAnimation(); | 3366 v5->UpdateAnimation(); |
3371 } | 3367 } |
3372 } | 3368 } |
3373 } | 3369 } |
3374 | 3370 |
3375 | |
3376 //----- (0040281C) -------------------------------------------------------- | 3371 //----- (0040281C) -------------------------------------------------------- |
3377 void Actor::_40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) | 3372 void Actor::_40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5) |
3378 { | 3373 { |
3379 unsigned int v5; // edi@1 | 3374 unsigned int v5; // edi@1 |
3380 int v6; // eax@1 | 3375 int v6; // eax@1 |
3453 v7->uCurrentActionTime = 0; | 3448 v7->uCurrentActionTime = 0; |
3454 v7->uPitchAngle = v14; | 3449 v7->uPitchAngle = v14; |
3455 v7->uAIState = Pursuing; | 3450 v7->uAIState = Pursuing; |
3456 v7->UpdateAnimation(); | 3451 v7->UpdateAnimation(); |
3457 } | 3452 } |
3458 | |
3459 | 3453 |
3460 //----- (00402686) -------------------------------------------------------- | 3454 //----- (00402686) -------------------------------------------------------- |
3461 void Actor::_402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) | 3455 void Actor::_402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4) |
3462 { | 3456 { |
3463 unsigned int v4; // edi@1 | 3457 unsigned int v4; // edi@1 |
3815 return 0; | 3809 return 0; |
3816 } | 3810 } |
3817 return 0; | 3811 return 0; |
3818 } | 3812 } |
3819 | 3813 |
3820 | |
3821 //----- (0045976D) -------------------------------------------------------- | 3814 //----- (0045976D) -------------------------------------------------------- |
3822 void Actor::UpdateAnimation() | 3815 void Actor::UpdateAnimation() |
3823 { | 3816 { |
3824 //AIState state; // edx@1 | 3817 //AIState state; // edx@1 |
3825 //unsigned int result; // eax@1 | 3818 //unsigned int result; // eax@1 |
3956 for (int i=0;i<4;++i ) | 3949 for (int i=0;i<4;++i ) |
3957 pSoundSampleIDs[i]=v3->pSoundSampleIDs[i]; | 3950 pSoundSampleIDs[i]=v3->pSoundSampleIDs[i]; |
3958 } | 3951 } |
3959 } | 3952 } |
3960 | 3953 |
3961 | |
3962 //----- (00459667) -------------------------------------------------------- | 3954 //----- (00459667) -------------------------------------------------------- |
3963 void Actor::Remove() | 3955 void Actor::Remove() |
3964 { | 3956 { |
3965 this->uAIState = Removed; | 3957 this->uAIState = Removed; |
3966 } | 3958 } |
3967 | |
3968 | 3959 |
3969 //----- (0044FD29) -------------------------------------------------------- | 3960 //----- (0044FD29) -------------------------------------------------------- |
3970 int Actor::_44FD29(int a2) | 3961 int Actor::_44FD29(int a2) |
3971 { | 3962 { |
3972 Actor *v2; // edi@1 | 3963 Actor *v2; // edi@1 |