annotate TurnEngine.cpp @ 2033:e78fa9082174

UIControl module
author Ritor1
date Tue, 19 Nov 2013 20:23:42 +0600
parents 3ef25d06b9b0
children 28cb79ae2f6f
rev   line source
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
2 #include "MM7.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
3 #include "mm7_data.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
4 #include "Actor.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
5 #include "Player.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
6 #include "Party.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
7 #include "AudioPlayer.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
8 #include "SpriteObject.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
9 #include "Time.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
10 #include "stru298.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
11 #include "IconFrameTable.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
12 #include "Viewport.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
13 #include "FactionTable.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
14
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
15 #include "TurnEngine.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
16
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
17
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
18 #include "TurnEngine.h"
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
19 struct stru262_TurnBased *pTurnEngine = new stru262_TurnBased;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
20
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
21
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
22 //----- (00404544) --------------------------------------------------------
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
23 void stru262_TurnBased::SortTurnQueue()
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
24 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
25
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
26 int active_actors;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
27 TurnBased_QueueElem *current_top; // eax@16
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
28 TurnBased_QueueElem *test_element; // ecx@18
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
29 TurnBased_QueueElem temp_elem;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
30 int i,j;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
31 unsigned int p_type;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
32 unsigned int p_id;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
33
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
34 active_actors = this->uActorQueueSize;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
35 //set non active actors in queue initiative that not allow them to paticipate
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
36 for( i=0; i<uActorQueueSize; ++i)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
37 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
38 p_type = PID_TYPE(pQueue[i].uPackedID);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
39 p_id = PID_ID(pQueue[i].uPackedID);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
40
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
41 if ( p_type == OBJECT_Actor )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
42 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
43 pActors[p_id].uAttributes |= 0x80u;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
44 if ( !pActors[p_id].CanAct() )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
45 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
46 --active_actors;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
47 pQueue[i].actor_initiative = 1001;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
48 pActors[p_id].uAttributes &= ~0x80;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
49 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
50 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
51 else if ( p_type == OBJECT_Player)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
52 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
53 if ( !pParty->pPlayers[p_id].CanAct() )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
54 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
55 --active_actors;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
56 pQueue[i].actor_initiative = 1001;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
57 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
58 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
59 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
60 //sort
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
61 if (uActorQueueSize>0)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
62 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
63 for( i=0; i<uActorQueueSize-1; ++i)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
64 {
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
65 current_top=&pQueue[i];
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
66 for(j=i+1; j<uActorQueueSize;++j )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
67 {
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
68 test_element=&pQueue[j];
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
69 if ( test_element->actor_initiative < current_top->actor_initiative || // if less initiative -> top
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
70 ((test_element->actor_initiative == current_top->actor_initiative) &&
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
71 (
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
72 ((PID_TYPE(test_element->uPackedID) == OBJECT_Player) && (PID_TYPE(current_top->uPackedID) == OBJECT_Actor)) || //player preferable
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
73 ((PID_TYPE(test_element->uPackedID) == PID_TYPE(current_top->uPackedID)) && (PID_ID(test_element->uPackedID) < PID_ID(current_top->uPackedID))) //less id preferable
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
74 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
75 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
76 )
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
77 { //swap
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
78 memcpy(&temp_elem,current_top,sizeof(TurnBased_QueueElem));
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
79 memcpy(current_top,test_element, sizeof(TurnBased_QueueElem));
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
80 memcpy(test_element, &temp_elem, sizeof(TurnBased_QueueElem));
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
81 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
82 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
83 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
84 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
85 uActorQueueSize = active_actors;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
86 if ( PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player) //we have player at queue top
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
87 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
88 uActiveCharacter = PID_ID(pQueue[0].uPackedID)+1;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
89 field_18 |= TE_PLAYER_TURN;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
90 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
91 else
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
92 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
93 uActiveCharacter = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
94 field_18 &= ~TE_PLAYER_TURN;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
95 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
96 for(i=0; i<uActorQueueSize; ++i)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
97 {
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
98 if ( PID_TYPE(pQueue[i].uPackedID) == OBJECT_Player) //set recovery times
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
99 pParty->pPlayers[PID_ID(pQueue[i].uPackedID)].uTimeToRecovery = (unsigned __int16)((double)pQueue[i].actor_initiative * 0.46875);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
100 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
101
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
102
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
103 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
104
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
105 //----- (0040471C) --------------------------------------------------------
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
106 void stru262_TurnBased::ApplyPlayerAction()
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
107 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
108 if ( pParty->bTurnBasedModeOn == 1 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
109 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
110 if ( pTurnEngine->turn_stage == 2 )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
111 _406457(0);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
112 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
113 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
114
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
115 //----- (004059DB) --------------------------------------------------------
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
116 void stru262_TurnBased::Start()
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
117 {
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
118
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
119 int v3; // esi@1
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
120 unsigned int actor_id; // esi@7
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
121 unsigned int v8; // edx@10
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
122 int v17; // edx@22
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
123 AIDirection v30; // [sp+Ch] [bp-68h]@10
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
124 AIDirection v31; // [sp+28h] [bp-4Ch]@10
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
125 AIDirection a3; // [sp+44h] [bp-30h]@10
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
126 Player *pPlayer; // [sp+6Ch] [bp-8h]@1
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
127 int v40b;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
128 int activ_players[4];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
129 int players_recovery_time[4];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
130 int a_players_count;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
131 int i,j;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
132 int temp;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
133
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
134 pTurnEngine->field_18 &= ~TE_HAVE_PENDING_ACTIONS;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
135 pEventTimer->TrackGameTime();
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
136 pAudioPlayer->StopChannels(-1, -1);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
137 pAudioPlayer->PlaySound(SOUND_207, 0, 0, -1, 0, 0, 0, 0);
1861
a86c60679949 changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents: 1679
diff changeset
138 pPlayer = pParty->pPlayers.data();
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
139 dword_50C998_turnbased_icon_1A = 8 * pIconsFrameTable->pIcons[uIconID_TurnStart].uAnimLength;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
140 dword_50C994 = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
141
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
142 this->turn_initiative = 100;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
143 this->turns_count = 0;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
144 this->ai_turn_timer = 64;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
145 this->turn_stage = 1;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
146 this->uActorQueueSize = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
147
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
148 for ( v3 = 0; v3 < 4 ; ++v3 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
149 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
150 if ( pParty->pPlayers[v3].CanAct() )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
151 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
152 this->pQueue[this->uActorQueueSize].uPackedID = PID(OBJECT_Player,v3);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
153 this->pQueue[this->uActorQueueSize].AI_action_type = TE_AI_PURSUE;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
154 this->pQueue[this->uActorQueueSize].uActionLength = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
155 pParty->pTurnBasedPlayerRecoveryTimes[this->uActorQueueSize] = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
156 ++this->uActorQueueSize;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
157 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
158 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
159
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
160 for ( v3 = 0; v3 < ai_arrays_size ; ++v3 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
161 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
162 actor_id = ai_near_actors_ids[v3];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
163 if (actor_id == 10)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
164 continue;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
165 if ( pActors[actor_id].CanAct() )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
166 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
167 if ( pActors[actor_id].uAttributes & 0x8000 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
168 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
169 v8 = ai_near_actors_targets_pid[actor_id];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
170 pActors[actor_id].uAttributes |= 0x80;
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
171 Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), v8, &v31, 0);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
172 memcpy(&v30, &v31, sizeof(AIDirection));
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
173 Actor::AI_StandOrBored(actor_id, 4, 32, &v30);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
174 this->pQueue[this->uActorQueueSize].uPackedID = PID(OBJECT_Actor,actor_id);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
175 this->pQueue[this->uActorQueueSize].AI_action_type = TE_AI_PURSUE;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
176 this->pQueue[this->uActorQueueSize].uActionLength = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
177 ++this->uActorQueueSize;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
178 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
179 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
180 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
181
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
182 a_players_count=0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
183 for ( v40b = 0; v40b < this->uActorQueueSize; ++v40b )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
184 {
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
185 //set initial initiative for turn actors
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
186 if ( PID_TYPE(this->pQueue[v40b].uPackedID) == OBJECT_Player )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
187 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
188 if ( pPlayers[PID_ID(this->pQueue[v40b].uPackedID) + 1]->uTimeToRecovery != 0 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
189 {
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
190 this->pQueue[v40b].actor_initiative = (signed int)((double)pPlayers[PID_ID(this->pQueue[v40b].uPackedID) + 1]->uTimeToRecovery * 0.46875);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
191 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
192 else
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
193 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
194 activ_players[a_players_count] = v40b;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
195 ++a_players_count;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
196 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
197 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
198 else if ( PID_TYPE(this->pQueue[v40b].uPackedID) == OBJECT_Actor )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
199 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
200 v17 = rand() % 99;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
201 if ( v17 < 33 )
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
202 this->pQueue[v40b].actor_initiative = 1;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
203 else
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
204 this->pQueue[v40b].actor_initiative= (v17 >= 66)? 5 : 3;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
205 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
206 else
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
207 { //fot non player and actor
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
208 this->pQueue[v40b].actor_initiative = 666;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
209 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
210 this->pQueue[v40b].actor_initiative += 16;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
211 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
212
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
213 if ( a_players_count > 0 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
214 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
215 for (i=0; i<a_players_count; ++i)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
216 players_recovery_time[i] = pParty->pPlayers[PID_ID(this->pQueue[activ_players[i]].uPackedID)].GetAttackRecoveryTime(0);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
217 //sort players by recovery time
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
218 for (i=0; i < a_players_count-1; ++i)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
219 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
220 for(j=i+1; j<a_players_count;++j )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
221 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
222 if (players_recovery_time[j] < players_recovery_time[i]) //swap values
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
223 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
224 temp = players_recovery_time[i];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
225 players_recovery_time[i] = players_recovery_time[j];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
226 players_recovery_time[j] = temp;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
227
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
228 temp = activ_players[i];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
229 activ_players[i] = activ_players[j];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
230 activ_players[j] = temp;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
231 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
232 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
233 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
234
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
235 for (i=0; i<a_players_count; ++i)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
236 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
237 this->pQueue[activ_players[i]].actor_initiative = i+2;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
238 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
239 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
240 this->SortTurnQueue();
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
241 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
242
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
243
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
244
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
245 //----- (00405CFF) --------------------------------------------------------
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
246 void stru262_TurnBased::End(bool bPlaySound)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
247 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
248
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
249 ObjectType objType; // eax@13
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
250 int objID; // esi@13
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
251 int i;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
252
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
253 this->turn_stage = 0;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
254
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
255 for( i=0; i<uActorQueueSize; ++i)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
256 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
257 if ( PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
258 pActors[PID_ID(pQueue[i].uPackedID)].uAttributes &= ~0x80;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
259 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
260
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
261 for( i=0; i<uNumSpriteObjects; ++i)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
262 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
263 if (pSpriteObjects[i].uAttributes & 4)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
264 pSpriteObjects[i].uAttributes &= ~0x04;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
265 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
266
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
267 for( i=0; i<uActorQueueSize; ++i)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
268 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
269 objType = (ObjectType)PID_TYPE(pQueue[i].uPackedID);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
270 objID = PID_ID(pQueue[i].uPackedID);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
271 if ( objType == OBJECT_Player )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
272 {
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
273 pPlayers[objID + 1]->uTimeToRecovery = (unsigned __int16)((double)pQueue[i].actor_initiative * 2.133333333333333);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
274 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
275 else if ( objType == OBJECT_Actor )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
276 {
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
277 pActors[objID].pMonsterInfo.uRecoveryTime = (unsigned __int16)((double)pQueue[i].actor_initiative * 2.133333333333333);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
278 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
279 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
280
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
281 pAudioPlayer->StopChannels(-1, -1);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
282 if ( bPlaySound != 0 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
283 pAudioPlayer->PlaySound(SOUND_206, 0, 0, -1, 0, 0, 0, 0);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
284 pTurnEngine->field_18 &= ~TE_HAVE_PENDING_ACTIONS;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
285 pEventTimer->StopGameTime();
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
286 dword_50C994 = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
287 dword_50C998_turnbased_icon_1A = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
288 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
289 // 50C994: using guessed type int dword_50C994;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
290 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
291
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
292 //----- (00405E14) --------------------------------------------------------
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
293 void stru262_TurnBased::AITurnBasedAction()
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
294 {
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
295 AIDirection v6; // esi@21
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
296 int v7; // eax@21
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
297 AIDirection a3; // [sp+4h] [bp-68h]@21
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
298 AIDirection v14; // [sp+20h] [bp-4Ch]@21
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
299 AIDirection v15; // [sp+3Ch] [bp-30h]@21
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
300 Actor *curr_actor; // [sp+58h] [bp-14h]@2
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
301 int target_pid; // [sp+5Ch] [bp-10h]@6
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
302 int shrinked;
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
303 int i,j;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
304
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
305 for (i =0; i<uNumActors; ++i )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
306 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
307 curr_actor=&pActors[i];
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
308 shrinked=pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0;
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
309 for (j =0; j<22; ++j) //check expired spell Buffs
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
310 {
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
311 if(j != 10)
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
312 pActors[i].pActorBuffs[j].IsBuffExpiredToTime(pParty->uTimePlayed);
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
313 }
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
314 if (shrinked && pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <=0) //buff 3 expired
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
315 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
316 pActors[i].uActorHeight = pMonsterList->pMonsters[pActors[i].pMonsterInfo.uID - 1].uMonsterHeight;
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
317 }
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
318 if(!(curr_actor->uAttributes&0x80)&&
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
319 (!curr_actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime)&&
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
320 (!curr_actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime))
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
321 {
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
322 curr_actor->uCurrentActionTime += pMiscTimer->uTimeElapsed;
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
323 if (curr_actor->uCurrentActionTime>=curr_actor->uCurrentActionLength)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
324 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
325 target_pid = ai_near_actors_targets_pid[i];
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
326 Actor::GetDirectionInfo(PID(OBJECT_Actor,i), target_pid, &v6, 0);
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
327 memcpy(&v15, &v6, sizeof(AIDirection));
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
328 memcpy(&v14, &v15, sizeof(AIDirection));
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
329 v7 = curr_actor->uAIState;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
330 if(v7==Dying)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
331 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
332 curr_actor->uCurrentActionTime = 0;
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
333 curr_actor->uCurrentActionLength = 0;
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
334 curr_actor->uAIState = Dead;
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
335 curr_actor->UpdateAnimation();
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
336 }
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
337 else if ( (v7 > AIState::Removed)&&(v7 < AIState::Disabled))
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
338 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
339 Actor::AI_StandOrBored(i, target_pid, 32, &v14);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
340 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
341 }
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
342 }
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
343 }
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
344
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
345 if ( turn_stage == 1 )
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
346 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
347 if ( ai_turn_timer == 64 )
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
348 ActorAISetMovementDecision();
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
349 else if ( ai_turn_timer > 0 )
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
350 ActorAIDoAdditionalMove();
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
351 else
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
352 {
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
353 ActorAIStopMovement();
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
354 turn_initiative = 100;
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
355 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
356 ai_turn_timer -= pEventTimer->uTimeElapsed;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
357 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
358 else if ( turn_stage == 2 )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
359 {
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
360 if ( !(field_18 &TE_FLAG_1))
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
361 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
362 if ( turn_initiative == 100 )
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
363 {
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
364 StartTurn();
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
365 SetAIRecoveryTimes();
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
366 return;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
367 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
368 if ( turn_initiative > 0 || pQueue[0].actor_initiative <= 0 )
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
369 {
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
370 _4065B0();
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
371 SetAIRecoveryTimes();
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
372 }
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
373 }
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
374 NextTurn();
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
375 }
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
376 else if ( turn_stage == 3 )
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
377 {
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
378 if ( (uActionPointsLeft > 0) && (!(field_18 & TE_FLAG_8)) )
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
379 ActorAIChooseNewTargets();
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
380 else
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
381 {
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
382 field_18 &= ~TE_FLAG_8;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
383 turn_stage = 1;
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
384 ai_turn_timer = 64;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
385 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
386 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
387 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
388
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
389
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
390 //----- (00406051) --------------------------------------------------------
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
391 void stru262_TurnBased::StartTurn()
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
392 {
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
393 int player_num, actor_num, i, j;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
394
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
395 pending_actions = 0;
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
396 //add player to queue if he can act
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
397 for(player_num=0; player_num<4; ++player_num)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
398 {
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
399 for(j=0; j<uActorQueueSize; ++j)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
400 {
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
401 if (PID_TYPE(pQueue[j].uPackedID)== OBJECT_Player)
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
402 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
403 if (pPlayers[PID_ID(pQueue[j].uPackedID) + 1]->CanAct() && (player_num != PID_ID(pQueue[j].uPackedID)) )
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
404 break;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
405 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
406 }
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
407 if (j==uActorQueueSize )
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
408 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
409 pQueue[uActorQueueSize].uPackedID = PID(OBJECT_Player,player_num);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
410 pQueue[uActorQueueSize].actor_initiative = 100;
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
411 pQueue[uActorQueueSize].uActionLength = 0;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
412 pQueue[uActorQueueSize].AI_action_type = TE_AI_STAND;
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
413 ++uActorQueueSize;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
414 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
415 }
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
416 //add new arrived actors
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
417 for(actor_num=0; actor_num<ai_arrays_size; ++actor_num)
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
418 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
419 for(j=0; j<uActorQueueSize; ++j)
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
420 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
421 if ((PID_TYPE(pQueue[j].uPackedID)== OBJECT_Actor)&&
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
422 ai_near_actors_ids[actor_num] == PID_ID(pQueue[j].uPackedID))
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
423 break;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
424 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
425 if (j==uActorQueueSize )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
426 {
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
427 pQueue[uActorQueueSize].uPackedID = PID(OBJECT_Actor,ai_near_actors_ids[actor_num]);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
428 pQueue[uActorQueueSize].actor_initiative = 1;
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
429 pQueue[uActorQueueSize].uActionLength = 0;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
430 pQueue[uActorQueueSize].AI_action_type = TE_AI_STAND;
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
431 ++uActorQueueSize;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
432 }
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
433 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
434
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
435 ++turns_count;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
436 turn_initiative = 100;
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
437
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
438 for(i=0; i<uActorQueueSize; ++i)
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
439 {
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
440 if (pQueue[i].actor_initiative == 0 )
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
441 pQueue[i].actor_initiative = 100;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
442 }
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
443
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
444 StepTurnQueue();
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
445 for(i=0; i<uActorQueueSize; ++i)
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
446 {
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
447 if ((PID_TYPE(pQueue[i].uPackedID)==OBJECT_Player)||(pQueue[i].actor_initiative > 0))
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
448 break;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
449 AI_Action_(i);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
450 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
451 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
452 // 4F75D8: using guessed type int ai_arrays_size;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
453
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
454 //----- (004061CA) --------------------------------------------------------
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
455 void stru262_TurnBased::NextTurn()
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
456 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
457 Actor *curr_actor; // eax@9
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
458 int ai_state; // ecx@9
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
459 int v13; // [sp+10h] [bp-4h]@7
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
460 int i;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
461 int monster_ai_state;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
462 int monster; // eax@5
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
463
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
464 SortTurnQueue();
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
465 if (PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player)
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
466 uActiveCharacter = PID_ID(pQueue[0].uPackedID) + 1;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
467 else
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
468 uActiveCharacter = 0;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
469 viewparams->bRedrawGameUI = 1;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
470
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
471 if ( pending_actions )
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
472 {
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
473 pTurnEngine->field_18 |= TE_HAVE_PENDING_ACTIONS;
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
474 return;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
475 }
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
476 pTurnEngine->field_18 &= ~TE_HAVE_PENDING_ACTIONS;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
477 if ( pQueue[0].actor_initiative <= 0 )
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
478 return;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
479
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
480 v13 = 0;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
481 if (uActorQueueSize > 0 )
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
482 {
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
483
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
484 for (i=0; i<uActorQueueSize; ++i )
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
485 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
486 if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor)
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
487 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
488 curr_actor = &pActors[PID_ID(pQueue[i].uPackedID)];
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
489 ai_state = curr_actor->uAIState;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
490 if ( (ai_state == AIState::Dying) || (ai_state == AIState::Stunned) || (ai_state == AIState::AttackingMelee) ||
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
491 (ai_state == AIState::AttackingRanged1) || (ai_state == AIState::AttackingRanged2) ||
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
492 (ai_state == AIState::AttackingRanged3) || (ai_state == AIState::AttackingRanged4) || (ai_state ==AIState::Summoned))
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
493 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
494 curr_actor->uCurrentActionTime += pEventTimer->uTimeElapsed;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
495 if ( curr_actor->uCurrentActionTime < curr_actor->uCurrentActionLength )
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
496 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
497 v13 = 1;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
498 }
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
499 else if ( ai_state == AIState::Dying )// Dying
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
500 {
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
501 curr_actor->uAIState = AIState::Dead;
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
502 curr_actor->uCurrentActionTime = 0;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
503 curr_actor->uCurrentActionLength = 0;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
504 curr_actor->UpdateAnimation();
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
505 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
506 else
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
507 {
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
508 if ( ai_state == AIState::Stunned ) //Stunned
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
509 Actor::AI_StandOrBored(PID_ID(pQueue[i].uPackedID), ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)], 32, 0);
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
510 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
511 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
512 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
513 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
514 if ( v13 != 0 )
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
515 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
516 field_18 |= TE_FLAG_1;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
517 return;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
518 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
519 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
520
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
521 field_18 &= ~TE_FLAG_1;
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
522 //set all actors to stay
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
523 for (i=0; i<uActorQueueSize; ++i )
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
524 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
525 if(PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor)
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
526 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
527 monster=PID_ID(pQueue[i].uPackedID);
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
528 monster_ai_state=pActors[monster].uAIState;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
529 if ((monster_ai_state != AIState::Dead) &&
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
530 (monster_ai_state != AIState::Dying) &&
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
531 (monster_ai_state != AIState::Removed) &&
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
532 (monster_ai_state != AIState::Summoned) &&
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
533 (monster_ai_state != AIState::Disabled))
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
534 {
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
535 pQueue[i].uActionLength = 0;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
536 Actor::AI_StandOrBored(monster, ai_near_actors_targets_pid[monster], 32, nullptr);
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
537 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
538 }
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
539 }
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
540 // turn tick
1341
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
541 turn_stage = 3;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
542 pParty->uTimePlayed += 213i64;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
543 _494035_timed_effects__water_walking_damage__etc();
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
544 uActionPointsLeft = 130;
67e47fc3133d TE refactiring continue
Gloval
parents: 1340
diff changeset
545 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
546
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
547 //----- (004063A1) --------------------------------------------------------
1679
4da5644df18f Cosmetics
Nomad
parents: 1546
diff changeset
548 bool stru262_TurnBased::StepTurnQueue()
4da5644df18f Cosmetics
Nomad
parents: 1546
diff changeset
549 {
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
550 int v9; // dx@12
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
551 int j;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
552
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
553 SortTurnQueue();
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
554 viewparams->bRedrawGameUI = 1;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
555 if ( pQueue[0].actor_initiative!=0 )
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
556 {
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
557 if (PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player)
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
558 {
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
559 do
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
560 {
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
561 for (j=0; j<uActorQueueSize; ++j )
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
562 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
563 --pQueue[j].actor_initiative;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
564 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
565 --turn_initiative;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
566 if (turn_initiative == 0)
1679
4da5644df18f Cosmetics
Nomad
parents: 1546
diff changeset
567 return true;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
568 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
569 while (pQueue[0].actor_initiative != 0);
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
570 }
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
571 else
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
572 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
573 if ( pQueue[0].actor_initiative>0 )
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
574 {
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
575 v9 = pActors[PID_ID(pQueue[0].uPackedID)].uAIState;
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
576 if (!(v9 == AIState::Dying || v9 == AIState::Dead ||
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
577 v9 == AIState::Disabled || v9 == AIState::Removed))
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
578 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
579 do
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
580 {
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
581 for (j=0; j<uActorQueueSize; ++j )
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
582 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
583 --pQueue[j].actor_initiative;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
584 if (pQueue[j].actor_initiative == 0)
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
585 pQueue[j].uActionLength = 0;
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
586 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
587 --turn_initiative;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
588 if (turn_initiative == 0)
1679
4da5644df18f Cosmetics
Nomad
parents: 1546
diff changeset
589 return true;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
590 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
591 while (pQueue[0].actor_initiative > 0);
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
592 }
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
593 }
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
594 }
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
595 }
1679
4da5644df18f Cosmetics
Nomad
parents: 1546
diff changeset
596 return false;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
597 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
598
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
599 //----- (00406457) --------------------------------------------------------
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
600 void stru262_TurnBased::_406457( int a2 )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
601 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
602 signed int v4; // ecx@2
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
603 signed int v6; // eax@2
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
604 int i;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
605 v6=0;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
606 if ( PID_TYPE(pQueue[a2].uPackedID) == OBJECT_Player)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
607 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
608 v4 = PID_ID(pQueue[a2].uPackedID);
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
609 if ( pParty->pTurnBasedPlayerRecoveryTimes[v4] )
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
610 pParty->pTurnBasedPlayerRecoveryTimes[v4] = 0;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
611 else
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
612 v6 = pPlayers[v4 + 1]->GetAttackRecoveryTime(0);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
613 if ( v6 < 30 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
614 v6 = 30;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
615 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
616 else
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
617 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
618 v6 = pMonsterStats->pInfos[pActors[PID_ID(pQueue[a2].uPackedID)].pMonsterInfo.uID].uRecoveryTime;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
619 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
620
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
621 pQueue[a2].actor_initiative = v6;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
622 SortTurnQueue();
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
623 if (PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player)
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
624 uActiveCharacter = PID_ID(pQueue[0].uPackedID) + 1;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
625 else
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
626 uActiveCharacter = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
627 viewparams->bRedrawGameUI = 1;
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
628
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
629 while ( (pQueue[0].actor_initiative > 0)&&(turn_initiative > 0) )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
630 {
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
631 for (i=0; i<uActorQueueSize; ++i)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
632 {
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
633 --pQueue[i].actor_initiative;
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
634 if (pQueue[i].actor_initiative==0)
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
635 pQueue[i].uActionLength=0;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
636 }
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
637 --turn_initiative;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
638 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
639 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
640
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
641 //----- (0040652A) --------------------------------------------------------
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
642 void stru262_TurnBased::SetAIRecoveryTimes()
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
643 {
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
644 int i;
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
645 int monster_ai_state;
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
646 Actor *monster; // eax@5
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
647
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
648 for (i=0; i<uActorQueueSize; ++i )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
649 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
650 if (pQueue[i].actor_initiative == 0)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
651 {
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
652 if(PID_TYPE(pQueue[i].uPackedID) == OBJECT_Player)
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
653 break;
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
654 monster=&pActors[PID_ID(pQueue[i].uPackedID)];
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
655 monster_ai_state=monster->uAIState;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
656 if (monster_ai_state == AIState::Standing ||
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
657 monster_ai_state == AIState::Fleeing ||
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
658 monster_ai_state == AIState::Fidgeting)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
659 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
660 pQueue[i].actor_initiative = pMonsterStats->pInfos[monster->pMonsterInfo.uID].uRecoveryTime;
1951
524fe0810f32 pActorBuffs[7] to pActorBuffs[ACTOR_BUFF_SLOWED]
Grumpy7
parents: 1950
diff changeset
661 if (monster->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0)
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
662 pQueue[i].actor_initiative*=2;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
663 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
664 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
665 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
666 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
667
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
668 //----- (004065B0) --------------------------------------------------------
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
669 void stru262_TurnBased::_4065B0()
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
670 {
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
671 int i;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
672
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
673 SortTurnQueue();
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
674 if (pQueue[0].actor_initiative <= 0)
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
675 {
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
676 for (i=0; i<uActorQueueSize; ++i )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
677 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
678 if ((PID_TYPE(pQueue[i].uPackedID)==OBJECT_Player)|| (pQueue[i].actor_initiative > 0) )
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
679 break;
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
680 if ((pQueue[i].uActionLength<=0) && (PID_TYPE(pQueue[i].uPackedID)==OBJECT_Actor))
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
681 AI_Action_(i);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
682 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
683 }
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
684 else
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
685 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
686 StepTurnQueue();
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
687 if (PID_TYPE(pQueue[0].uPackedID) == OBJECT_Player)
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
688 uActiveCharacter = PID_ID(pQueue[0].uPackedID) + 1;
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
689 else
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
690 uActiveCharacter = 0;
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
691 viewparams->bRedrawGameUI = 1;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
692 }
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
693
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
694 for (i=0; i<uActorQueueSize; ++i )
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
695 AIAttacks(i);
1333
d14bc530cddb turnengine refactor continue
Gloval
parents: 1332
diff changeset
696 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
697
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
698 //----- (00406648) --------------------------------------------------------
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
699 void stru262_TurnBased::AIAttacks( unsigned int queue_index )
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1456
diff changeset
700 {
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
701 TurnBased_QueueElem *v1; // ecx@1
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
702 int v3; // eax@1
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
703 unsigned int v4; // ebx@2
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
704 Actor *v5; // esi@2
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
705 char v19; // al@24
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
706 AIDirection a3; // [sp+Ch] [bp-3Ch]@2
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
707 AIDirection a4; // [sp+28h] [bp-20h]@2
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
708 TurnBased_QueueElem *v28; // [sp+44h] [bp-4h]@1
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
709 unsigned int a2a; // [sp+50h] [bp+8h]@2
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
710
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
711 v1 = &pQueue[queue_index];
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
712 v28 = v1;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
713 v3 = v1->uPackedID;
1343
Gloval
parents: 1342
diff changeset
714 if (PID_TYPE(pQueue[queue_index].uPackedID) == OBJECT_Actor)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
715 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
716 v4 = PID_ID(v3);
1343
Gloval
parents: 1342
diff changeset
717 a2a = ai_near_actors_targets_pid[PID_ID(pQueue[queue_index].uPackedID)];
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
718 Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
719 memcpy(&a4, &a3, sizeof(a4));
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
720 v5 = &pActors[PID_ID(v3)];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
721 LOWORD(v3) = v5->uAIState;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
722 if (( (short)v3 != AIState::Dead )&& ( (short)v3 != AIState::Disabled )&&( (short)v3 != AIState::Removed ))
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
723 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
724 v5->uCurrentActionTime += pEventTimer->uTimeElapsed;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
725 if ( (signed int)v5->uCurrentActionTime >= v5->uCurrentActionLength )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
726 {
1343
Gloval
parents: 1342
diff changeset
727 switch (v3)
Gloval
parents: 1342
diff changeset
728 {
Gloval
parents: 1342
diff changeset
729 case AIState::AttackingMelee:
1972
3ef25d06b9b0 Actor::special_ability_use_check moved to Actor and cleaned up
Grumpy7
parents: 1951
diff changeset
730 v19 = pActors[v4].special_ability_use_check(v4);
1343
Gloval
parents: 1342
diff changeset
731 stru_50FE08.Add( v28->uPackedID, 5120, v5->vPosition.x, v5->vPosition.y, v5->vPosition.z + ((signed int)v5->uActorHeight >> 1), v19, 1);
Gloval
parents: 1342
diff changeset
732 Actor::AI_Stand(v4, a2a, 0, &a4);
Gloval
parents: 1342
diff changeset
733 break;
Gloval
parents: 1342
diff changeset
734 case AIState::AttackingRanged1:
Gloval
parents: 1342
diff changeset
735 Actor::AI_RangedAttack(v4, &a4, v5->pMonsterInfo.uMissleAttack1Type, 0);
Gloval
parents: 1342
diff changeset
736 Actor::AI_Stand(v4, a2a, 0,&a4);
Gloval
parents: 1342
diff changeset
737 break;
Gloval
parents: 1342
diff changeset
738 case AIState::Dying:
Gloval
parents: 1342
diff changeset
739 v5->uCurrentActionTime = 0;
Gloval
parents: 1342
diff changeset
740 v5->uCurrentActionLength = 0;
Gloval
parents: 1342
diff changeset
741 v5->uAIState = Dead;
Gloval
parents: 1342
diff changeset
742 pActors[v4].UpdateAnimation();
Gloval
parents: 1342
diff changeset
743 break;
Gloval
parents: 1342
diff changeset
744 case AIState::Stunned:
Gloval
parents: 1342
diff changeset
745 Actor::AI_Stand(v4, a2a, 0,&a4);
Gloval
parents: 1342
diff changeset
746 break;
Gloval
parents: 1342
diff changeset
747 case AIState::AttackingRanged2:
Gloval
parents: 1342
diff changeset
748 Actor::AI_RangedAttack(v4, &a4, v5->pMonsterInfo.uMissleAttack2Type, 1);
Gloval
parents: 1342
diff changeset
749 Actor::AI_Stand(v4, a2a, 0,&a4);
Gloval
parents: 1342
diff changeset
750 break;
Gloval
parents: 1342
diff changeset
751 case AIState::AttackingRanged3:
Gloval
parents: 1342
diff changeset
752 Actor::AI_SpellAttack(v4, &a4, v5->pMonsterInfo.uSpell1ID, 2, v5->pMonsterInfo.uSpellSkillAndMastery1);
Gloval
parents: 1342
diff changeset
753 Actor::AI_Stand(v4, a2a, 0, &a4);
Gloval
parents: 1342
diff changeset
754 break;
Gloval
parents: 1342
diff changeset
755 case AIState::AttackingRanged4:
Gloval
parents: 1342
diff changeset
756 Actor::AI_SpellAttack(v4, &a4, v5->pMonsterInfo.uSpell2ID, 3, v5->pMonsterInfo.uSpellSkillAndMastery2);
Gloval
parents: 1342
diff changeset
757 Actor::AI_Stand(v4, a2a, 0, &a4);
Gloval
parents: 1342
diff changeset
758 break;
Gloval
parents: 1342
diff changeset
759 default:
Gloval
parents: 1342
diff changeset
760 if ( !(rand() % 2) )
Gloval
parents: 1342
diff changeset
761 Actor::AI_Bored(v4, a2a, &a4);
Gloval
parents: 1342
diff changeset
762 else
Gloval
parents: 1342
diff changeset
763 Actor::AI_Stand(v4, a2a, 64,&a4);
Gloval
parents: 1342
diff changeset
764 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
765 }
1343
Gloval
parents: 1342
diff changeset
766 }
Gloval
parents: 1342
diff changeset
767
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
768 }
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
769
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
770 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
771 // 50FE08: using guessed type stru298 stru_50FE08;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
772
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
773 //----- (0040680F) --------------------------------------------------------
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
774 void stru262_TurnBased::AI_Action_( int queue_index )
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
775 {
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
776 TurnBased_QueueElem *v2; // eax@1
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
777 unsigned int v3; // eax@1
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
778 unsigned int actor_id; // edi@2
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
779 Actor *v5; // ebx@2
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
780 AIDirection v7; // esi@10
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
781 int v8; // eax@10
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
782 int v9; // ecx@10
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
783 signed int v10; // eax@13
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
784 int v14; // eax@29
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
785 AIDirection a3; // [sp+Ch] [bp-44h]@10
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
786 AIDirection v18; // [sp+28h] [bp-28h]@10
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
787 int a2a; // [sp+44h] [bp-Ch]@2
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
788 int v20; // [sp+48h] [bp-8h]@10
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
789 TurnBased_QueueElem *v21; // [sp+4Ch] [bp-4h]@1
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
790 signed int v22; // [sp+58h] [bp+8h]@10
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
791
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
792 v2 = &pQueue[queue_index];
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
793 v21 = v2;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
794 v2->uActionLength = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
795 v3 = v2->uPackedID;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
796 if (PID_TYPE(pQueue[queue_index].uPackedID) == OBJECT_Actor)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
797 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
798
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
799 actor_id = PID_ID(pQueue[queue_index].uPackedID);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
800 a2a = v3;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
801 v5 = &pActors[actor_id];
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
802 v3 = v5->uAIState;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
803 if (!(v3 == AIState::Dying || v3 == AIState::Dead || v3 == AIState::Summoned ||
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
804 v3 == AIState::Disabled || v3 == AIState::Removed))
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
805 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
806
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
807 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true);
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
808 v22 = ai_near_actors_targets_pid[actor_id];
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
809 if ( v5->pMonsterInfo.uHostilityType && !v22)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
810 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
811 Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), v22, &v7, 0);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
812 v8 = v5->uActorRadius;
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
813 memcpy(&a3, &v7, sizeof(AIDirection));
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
814 memcpy(&v18, &a3, sizeof(AIDirection));
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
815 v9 = a3.uDistance - v8;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
816 v20 = a3.uDistance - v8;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
817 if ( v20 < 0 )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
818 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
819 v9 = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
820 v20 = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
821 }
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
822
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
823 if (PID_TYPE(v22) == OBJECT_Actor)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
824 //v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
825 v10 = pFactionTable->relations[(pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID) / 3 + 1][(v5->pMonsterInfo.uID - 1) / 3 + 1];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
826 else
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
827 v10 = 4;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
828
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
829 switch (v10)
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
830 {
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
831 case 1:
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
832 if ( (double)(signed int)v20 < 307.2 )
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
833 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
834 break;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
835 case 2:
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
836 if ( v20 < 1024 )
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
837 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
838 break;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
839 case 3:
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
840 if ( v20 < 2560 )
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
841 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
842 break;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
843 case 4:
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
844 if ( v20 < 5120 )
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
845 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
846 break;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
847 }
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
848
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
849 if ( v5->pMonsterInfo.uHostilityType == 4 && v22 && (signed int)v9 < 5120 )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
850 {
1972
3ef25d06b9b0 Actor::special_ability_use_check moved to Actor and cleaned up
Grumpy7
parents: 1951
diff changeset
851 v14 = v5->special_ability_use_check(actor_id);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
852 v21->AI_action_type = TE_AI_STAND;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
853 switch (v14)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
854 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
855 case 1:
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
856 if ( v5->pMonsterInfo.uMissleAttack2Type )
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
857 {
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
858 Actor::AI_MissileAttack2(actor_id, v22, &v18);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
859 v21->AI_action_type = TE_AI_RANGED_ATTACK;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
860 }
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
861 break;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
862 case 2:
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
863 if(v5->pMonsterInfo.uSpell1ID)
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
864 {
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
865 Actor::AI_SpellAttack1(actor_id, v22, &v18);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
866 v21->AI_action_type = TE_AI_RANGED_ATTACK;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
867 }
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
868 break;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
869 case 3:
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
870 if(v5->pMonsterInfo.uSpell2ID)
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
871 {
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
872 Actor::AI_SpellAttack2(actor_id, v22, &v18);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
873 v21->AI_action_type = TE_AI_RANGED_ATTACK;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
874 }
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
875
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
876 break;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
877 default:
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
878 if ( v5->pMonsterInfo.uMissleAttack1Type )
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
879 {
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
880 Actor::AI_MissileAttack1(actor_id, v22, &v18);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
881 v21->AI_action_type = TE_AI_RANGED_ATTACK;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
882 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
883 }
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
884 if (!v21->AI_action_type)
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
885 if ( (double)v20 < 307.2)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
886 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
887 Actor::AI_MeleeAttack(actor_id, v22, &v18);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
888 v21->AI_action_type = TE_AI_MELEE_ATTACK;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
889 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
890 else
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
891 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
892 Actor::AI_Stand(actor_id, v22, 64, &v18);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
893 v21->AI_action_type = TE_AI_STAND;
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
894 }
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
895 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
896 else
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
897 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
898 Actor::AI_Stand(actor_id, v22, 64, &v18);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
899 v21->AI_action_type = TE_AI_STAND;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
900 }
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
901 v21->uActionLength = v5->uCurrentActionLength;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
902 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
903 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
904 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
905
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
906 //----- (00406A63) --------------------------------------------------------
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
907 void stru262_TurnBased::ActorAISetMovementDecision()
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
908 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
909
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
910 AIDirection a3; // [sp+8h] [bp-44h]@5
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
911 AIDirection v7; // [sp+24h] [bp-28h]@5
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
912 unsigned int target_pid; // [sp+40h] [bp-Ch]@5
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
913 int i;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
914
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
915 this->ai_turn_timer = 64;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
916 dword_50C994 = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
917 uActiveCharacter = 0;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
918 for (i=0; i<uActorQueueSize; ++i )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
919 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
920 if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
921 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
922 target_pid = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)];
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
923 Actor::GetDirectionInfo(pQueue[i].uPackedID, target_pid, &v7, 0);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
924 if ( !ActorMove(i) )
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
925 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), target_pid, 32, &v7);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
926 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
927 }
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
928 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
929 // 50C994: using guessed type int dword_50C994;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
930
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
931 //----- (00406AFE) --------------------------------------------------------
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
932 void stru262_TurnBased::ActorAIStopMovement()
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
933 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
934 AIDirection a3; // [sp+4h] [bp-48h]@5
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
935 AIDirection v7; // [sp+20h] [bp-2Ch]@5
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
936 unsigned int target_pid;
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
937 int i;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
938
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
939 for (i=0; i<uActorQueueSize; ++i )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
940 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
941 if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
942 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
943 target_pid = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)];
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
944 Actor::GetDirectionInfo(pQueue[i].uPackedID, target_pid, &v7, 0);
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
945 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), target_pid, 32, &v7);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
946 pQueue[i].AI_action_type = TE_AI_STAND;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
947 pQueue[i].uActionLength = 0;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
948 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
949 }
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
950 turn_stage = 2;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
951 ai_turn_timer = 100;
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1333
diff changeset
952
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
953 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
954
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
955 //----- (00406B9F) --------------------------------------------------------
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
956 void stru262_TurnBased::ActorAIDoAdditionalMove()
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
957 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
958 Actor *v6; // ebx@5
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
959 AIDirection a3; // [sp+0h] [bp-50h]@15
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
960 AIDirection v9; // [sp+1Ch] [bp-34h]@15
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
961 unsigned int v13; // [sp+44h] [bp-Ch]@8
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
962 int i;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
963
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
964 for (i=0; i<uActorQueueSize; ++i )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
965 {
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
966 if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
967 {
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
968 v6 = &pActors[PID_ID(pQueue[i].uPackedID)];
1946
aa3ca49a10f5 pActorBuffs[6] to pActorBuffs[ACTOR_BUFF_PARALYZED]
Grumpy7
parents: 1945
diff changeset
969 if ( !(v6->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0|| (v6->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0) ||
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
970 v6->uAIState == AIState::Dead || v6->uAIState == AIState::Removed || v6->uAIState == AIState::Disabled) )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
971 {
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
972 v13 = ai_near_actors_targets_pid[PID_ID(pQueue[i].uPackedID)];
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
973 Actor::GetDirectionInfo(pQueue[i].uPackedID, v13, &v9, 0);
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
974 if ( v6->uAIState == AIState::Pursuing || v6->uAIState == AIState::Tethered )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
975 {
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
976 if ( (double)(signed int)v9.uDistance < 307.2 )
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
977 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), v13, 32, &v9);
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
978 }
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
979 else
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
980 {
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
981 v6->uCurrentActionTime += pEventTimer->uTimeElapsed;
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
982 if ( v6->uCurrentActionTime > v6->uCurrentActionLength )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
983 {
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
984 if ( v6->uAIState == AIState::Dying )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
985 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
986 v6->uCurrentActionTime = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
987 v6->uCurrentActionLength = 0;
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
988 v6->uAIState = AIState::Dead;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
989 v6->UpdateAnimation();
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
990 }
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
991 if ( !ActorMove(i) )
1342
bdf0cc8620ad TE continue
Gloval
parents: 1341
diff changeset
992 Actor::AI_Stand(PID_ID(pQueue[i].uPackedID), v13, 32, &v9);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
993 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
994 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
995 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
996 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
997 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
998 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
999
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1000 //----- (00406D10) --------------------------------------------------------
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1001 bool stru262_TurnBased::ActorMove(signed int queue_position)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1002 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1003 int v2; // ecx@1
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1004 //int v3; // ecx@2
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1005 Actor *actor; // ebx@2
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1006
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
1007 AIDirection v9; // esi@10
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1008 int v10; // eax@10
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1009 int v11; // ecx@10
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1010 unsigned __int8 pHostileType; // al@12
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1011 AIDirection a3; // [sp+Ch] [bp-48h]@10
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1012 AIDirection pDir; // [sp+28h] [bp-2Ch]@10
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1013 int v28; // [sp+48h] [bp-Ch]@10
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1014 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1015 unsigned int uActorID; // [sp+50h] [bp-4h]@2
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1016 unsigned int a2a; // [sp+5Ch] [bp+8h]@7
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1017
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1018 // __debugbreak();//ñðàáàòûâàåò ïðè ïîøàãîâîì ðåæèìå ïîñëå ïÿòè øàãîâ
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1019 v2 = pQueue[queue_position].uPackedID;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1020 if (PID_TYPE(v2) == OBJECT_Player)
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1021 return 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1022 uActorID = PID_ID(v2);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1023 //uActorID = v3;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1024 actor = &pActors[uActorID];
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1025 //v5 = v4->uAIState;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1026 if ( actor->uAIState == AIState::Dead || actor->uAIState == AIState::Dying ||
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1027 actor->uAIState == AIState::Removed|| actor->uAIState == AIState::Disabled ||
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1028 actor->uAIState == AIState::Summoned )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1029 return 1;
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1030 v29 = &pTurnEngine->pQueue[queue_position];
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1031 a2a = ai_near_actors_targets_pid[uActorID];
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1032 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1033 if ( actor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[uActorID] )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1034 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
1035 Actor::GetDirectionInfo(pQueue[queue_position].uPackedID, ai_near_actors_targets_pid[uActorID], &v9, 0);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1036 v10 = actor->uActorRadius;
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
1037 memcpy(&a3, &v9, sizeof(AIDirection));
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1038 memcpy(&pDir, &a3, sizeof(AIDirection));
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1039 v11 = a3.uDistance - v10;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1040 v28 = a3.uDistance - v10;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1041 if ( v28 < 0 )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1042 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1043 v11 = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1044 v28 = 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1045 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1046 pHostileType = actor->pMonsterInfo.uHostilityType;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1047
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1048 switch (pHostileType)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1049 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1050 case 1:
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1051 if ( (double)v28 < 307.2 )
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1052 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1053 break;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1054 case 2:
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1055 if ( v28 < 1024 )
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1056 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1057 break;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1058 case 3:
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1059 if ( v28 < 2560 )
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1060 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1061 break;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1062 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1063
1950
8509a59af88f pActorBuffs[4] to pActorBuffs[ACTOR_BUFF_AFRAID]
Grumpy7
parents: 1946
diff changeset
1064 if ( actor->pActorBuffs[ACTOR_BUFF_AFRAID].uExpireTime > 0 )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1065 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1066 if (v11 < 10240 )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1067 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1068 Actor::AI_Flee(uActorID, a2a, 0, &pDir);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1069 v29->AI_action_type = 4;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1070 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1071 else
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1072 {
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1073 Actor::AI_RandomMove(uActorID, a2a, 1024, 0);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1074 v29->AI_action_type = TE_AI_PURSUE;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1075 }
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1076
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1077 v29->uActionLength = actor->uCurrentActionLength;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1078 return 1;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1079 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1080
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1081 if ( actor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long )
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1082 {
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1083 if ( !(actor->uAttributes & 0x020000) || actor->pMonsterInfo.uAIType == 1 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1084 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1085 if ( actor->pMonsterInfo.uAIType == 1 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1086 {
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1087 if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1088 Actor::AI_Stand(uActorID, a2a, 32, 0);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1089 else
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1090 Actor::AI_Flee(uActorID, a2a, 32, 0);
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1091 v29->AI_action_type = TE_AI_FLEE;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1092 v29->uActionLength = actor->uCurrentActionLength;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1093 return 1;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1094 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1095 if ( actor->pMonsterInfo.uAIType == 2 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1096 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1097
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1098 if (((double)actor->pMonsterInfo.uHP * 0.2) > (double)actor->sCurrentHP && (v11 < 10240 ) )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1099 {
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1100 if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1101 Actor::AI_Stand(uActorID, a2a, 32, 0);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1102 else
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1103 Actor::AI_Flee(uActorID, a2a, 32, 0);
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1104 v29->AI_action_type = TE_AI_FLEE;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1105 v29->uActionLength = actor->uCurrentActionLength;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1106 return 1;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1107 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1108 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1109 if ( actor->pMonsterInfo.uAIType == 3 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1110 {
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1111
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1112 if ( ((double)actor->pMonsterInfo.uHP * 0.1) > (double)actor->sCurrentHP && (v11 < 10240 ))
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1113 {
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1114 if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1115 Actor::AI_Stand(uActorID, a2a, 32, 0);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1116 else
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1117 Actor::AI_Flee(uActorID, a2a, 32, 0);
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1118 v29->AI_action_type = TE_AI_FLEE;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1119 v29->uActionLength = actor->uCurrentActionLength;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1120 return 1;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1121 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1122
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1123 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1124 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1125
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1126 if ( (double)(signed int)v28 < 307.2 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1127 return 0;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1128 if ( (signed int)v11 < 5120 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1129 {
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1130 if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 )
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1131 Actor::AI_Pursue1(uActorID, a2a, uActorID, 32, &pDir);
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1132 else
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1133 Actor::AI_Pursue2(uActorID, a2a, 32, &pDir, 307);
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1134 v29->AI_action_type = TE_AI_PURSUE;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1135 v29->uActionLength = actor->uCurrentActionLength;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1136 return 1;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1137 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1138 }
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1139 switch(actor->pMonsterInfo.uMovementType)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1140 {
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1141 case MONSTER_MOVEMENT_TYPE_SHORT:
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1142 Actor::AI_RandomMove(uActorID, a2a, 1024, 32);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1143 break;
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1144 case MONSTER_MOVEMENT_TYPE_MEDIUM:
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1145 Actor::AI_RandomMove(uActorID, a2a, 2560, 32);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1146 break;
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1147 case MONSTER_MOVEMENT_TYPE_LONG:
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1148 Actor::AI_RandomMove(uActorID, a2a, 5120, 32);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1149 break;
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1150 case MONSTER_MOVEMENT_TYPE_FREE:
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1151 Actor::AI_RandomMove(uActorID, a2a, 10240, 32);
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1152 break;
1456
5c95f2246c2a TE mostly working
Gloval
parents: 1450
diff changeset
1153 case MONSTER_MOVEMENT_TYPE_STAIONARY:
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1154 Actor::AI_Stand(uActorID, a2a, 32, 0);
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1155 break;
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1156 default:
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1157 return 1;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1158 }
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1159 v29->AI_action_type = TE_AI_PURSUE;
1448
5a5d0c713d47 some turn engine renaming
Gloval
parents: 1367
diff changeset
1160 v29->uActionLength = actor->uCurrentActionLength;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1161 return 1;
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1162 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1163
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1164 //----- (00406FA8) --------------------------------------------------------
1450
8ff3c675a726 more renaming TE
Gloval
parents: 1448
diff changeset
1165 void stru262_TurnBased::ActorAIChooseNewTargets()
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1166 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1167 Actor *curr_acror; // ebx@4
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1168 AIDirection a3; // [sp+Ch] [bp-6Ch]@8
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1169 AIDirection v9; // [sp+28h] [bp-50h]@8
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1170 AIDirection a4; // [sp+44h] [bp-34h]@8
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1171 unsigned int target_pid; // [sp+60h] [bp-18h]@1
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1172 int uActorID; // [sp+68h] [bp-10h]@4
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1173 int i;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1174
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1175 for (i=0; i<uActorQueueSize; ++i )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1176 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1177 if (PID_TYPE(pQueue[i].uPackedID) == OBJECT_Actor)
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1178 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1179 uActorID=PID_ID(pQueue[i].uPackedID);
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1180 curr_acror = &pActors[uActorID];
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1181 if ( !( curr_acror->uAIState == AIState::Summoned|| curr_acror->uAIState == AIState::Dead ||
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1182 curr_acror->uAIState == AIState::Removed || curr_acror->uAIState == AIState::Disabled) )
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1183 {
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1184 target_pid = ai_near_actors_targets_pid[uActorID];
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1185 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true);
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1861
diff changeset
1186 Actor::GetDirectionInfo(pQueue[i].uPackedID, target_pid, &v9, 0);
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1187 memcpy(&a4, &v9, sizeof(AIDirection));
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1188 curr_acror->uCurrentActionTime += pEventTimer->uTimeElapsed;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1189 if ( curr_acror->uCurrentActionTime > curr_acror->uCurrentActionLength )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1190 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1191 if ( curr_acror->uAIState == AIState::Dying )
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1192 {
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1193 curr_acror->uCurrentActionTime = 0;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1194 curr_acror->uCurrentActionLength = 0;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1195 curr_acror->uAIState = AIState::Dead;
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1196 curr_acror->UpdateAnimation();
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1197 break;
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1198 }
1367
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1199 if ( rand() % 2 )
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1200 Actor::AI_Stand(uActorID, target_pid, 64, &a4);
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1201 else
e33188605eeb te cleaning continue.
Gloval
parents: 1343
diff changeset
1202 Actor::AI_Bored(uActorID, target_pid, &a4);
1332
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1203 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1204 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1205 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1206 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1207 }
1e35cfed7928 turn engine file added
Gloval
parents:
diff changeset
1208