Mercurial > mm7
diff Actor.cpp @ 828:0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
author | Nomad |
---|---|
date | Wed, 27 Mar 2013 00:27:38 +0200 |
parents | c1da83d8223f |
children | dfd683c4f538 |
line wrap: on
line diff
--- a/Actor.cpp Tue Mar 26 20:06:51 2013 +0200 +++ b/Actor.cpp Wed Mar 27 00:27:38 2013 +0200 @@ -21,6 +21,14 @@ #include "GUIWindow.h" #include "GUIFont.h" +#include "MM7.h" + + + + + + + Actor pActors[500]; int uNumActors; @@ -384,7 +392,7 @@ int v15; // eax@34 AIDirection *v16; // esi@34 unsigned __int16 v17; // di@34 - int v18; // eax@34 + //int v18; // eax@34 int v19; // edi@34 int v20; // eax@35 int v21; // eax@39 @@ -444,7 +452,7 @@ int v75; // eax@184 AIDirection *v76; // esi@184 unsigned __int16 v77; // di@184 - int v78; // eax@184 + //int v78; // eax@184 int v79; // edx@185 int v80; // eax@185 int v81; // eax@189 @@ -456,7 +464,7 @@ unsigned __int16 v87; // di@192 __int16 v88; // ax@192 signed int v89; // ecx@192 - int v90; // eax@192 + //int v90; // eax@192 signed int v91; // eax@200 int v92; // eax@201 int v93; // ecx@207 @@ -609,9 +617,7 @@ a1.uSoundID = 0; a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(v13, v14, v15); - v18 = 8 * LODWORD(v120); - LOBYTE(v18) = 8 * LOBYTE(v120) | AI_OBJECT_ACTOR; - a1.spell_caster_pid = v18; + a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120)); a1.uSpriteFrameID = 0; a1.spell_target_pid = 0; a1.field_60_distance_related_prolly_lod = 3; @@ -693,10 +699,8 @@ v89 = v86->uDistance; a1.uSectorID = v88; LODWORD(v119) = v89; - v90 = 8 * LODWORD(v120); - LOBYTE(v90) = 8 * LOBYTE(v120) | OBJECT_Actor; a1.uSpriteFrameID = 0; - a1.spell_caster_pid = v90; + a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120)); a1.spell_target_pid = 0; a1.field_60_distance_related_prolly_lod = 3; if ( (double)v89 >= 307.2 ) @@ -1382,9 +1386,7 @@ a1.uSoundID = 0; a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(v73, v74, v75); - v78 = 8 * LODWORD(v120); - LOBYTE(v78) = 8 * LOBYTE(v120) | OBJECT_Actor; - a1.spell_caster_pid = v78; + a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120)); a1.uSpriteFrameID = 0; a1.spell_target_pid = 0; a1.field_60_distance_related_prolly_lod = 3; @@ -1490,7 +1492,7 @@ unsigned __int16 v9; // ax@19 __int16 v10; // ax@19 signed int v11; // ecx@19 - int v12; // eax@19 + //int v12; // eax@19 int v13; // edx@28 //SpriteObject a1; // [sp+Ch] [bp-74h]@1 unsigned int v15; // [sp+7Ch] [bp-4h]@1 @@ -1580,10 +1582,8 @@ v10 = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); v11 = v4->uDistance; a1.uSectorID = v10; - v12 = 8 * v15; - LOBYTE(v12) = 8 * v15 | AI_OBJECT_ACTOR; a1.uSpriteFrameID = 0; - a1.spell_caster_pid = v12; + a1.spell_caster_pid = PID(OBJECT_Actor, v15); a1.spell_target_pid = 0; if ( (double)v11 >= 307.2 ) { @@ -1645,7 +1645,7 @@ unsigned __int16 v4; // ax@5 int v5; // ebx@6 int v6; // ecx@6 - int v7; // eax@6 + //int v7; // eax@6 SpriteObject a1; // [sp+Ch] [bp-78h]@1 unsigned int v10; // [sp+7Ch] [bp-8h]@1 int v11; // [sp+80h] [bp-4h]@6 @@ -1686,10 +1686,8 @@ a1.uSoundID = 0; a1.uAttributes = 0; a1.uSectorID = pIndoor->GetSector(v5, a1.vPosition.y, v6); - v7 = 8 * v10; - LOBYTE(v7) = 8 * v10 | OBJECT_Actor; a1.uSpriteFrameID = 0; - a1.spell_caster_pid = v7; + a1.spell_caster_pid = PID(OBJECT_Actor, v10); a1.spell_target_pid = 0; a1.field_60_distance_related_prolly_lod = 3; a1.field_61 = 4; @@ -1983,7 +1981,7 @@ v9 = &pActors[v5]; if ( !a4 ) { - v10 = Actor::GetDirectionInfo(8 * v5 | AI_OBJECT_ACTOR, v4, &a3, 0); + v10 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v5), v4, &a3, 0); v7 = &v13; memcpy(&v13, v10, sizeof(v13)); v8 = 0; @@ -2020,7 +2018,7 @@ AIDirection a3; if (!a4) - a4 = Actor::GetDirectionInfo(8 * uActorID | 3, object_to_face_pid, &a3, 0); + a4 = Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), object_to_face_pid, &a3, 0); actor->uAIState = Standing; if (!uActionLength) @@ -2121,7 +2119,7 @@ v13 = 0; if ( !arg0 ) { - v14 = Actor::GetDirectionInfo(8 * v24 | OBJECT_Actor, a2, &a3, 0); + v14 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v24), a2, &a3, 0); v12 = &v20; memcpy(&v20, v14, sizeof(v20)); v13 = 0; @@ -3173,7 +3171,7 @@ int v4; // eax@3 int v5; // eax@4 unsigned int v6; // eax@6 - signed int v7; // eax@12 + //signed int v7; // eax@12 signed int v8; // [sp-18h] [bp-1Ch]@10 signed int v9; // [sp-14h] [bp-18h]@10 int v10; // [sp-10h] [bp-14h]@10 @@ -3220,9 +3218,7 @@ v9 = 0; v8 = 0; } - v7 = 8 * uActorID; - LOBYTE(v7) = 8 * uActorID | OBJECT_Actor; - pAudioPlayer->PlaySound((SoundID)(signed __int16)v3, v7, 0, v8, v9, v10, v11, v12); + pAudioPlayer->PlaySound((SoundID)(signed __int16)v3, PID(OBJECT_Actor, uActorID), 0, v8, v9, v10, v11, v12); } } @@ -3628,7 +3624,7 @@ if ( v23 <= v11 && v27 <= v11 && v12 <= v11 - && sub_4070EF_prolly_collide_objects(8 * i | OBJECT_Actor, 8 * uActorID | OBJECT_Actor) + && sub_4070EF_prolly_collide_objects(PID(OBJECT_Actor, i), PID(OBJECT_Actor, uActorID)) && v23 * v23 + v27 * v27 + v19 * v19 < (unsigned int)v25 ) { v25 = v23 * v23 + v27 * v27 + v19 * v19; @@ -3645,7 +3641,7 @@ { //v13 = 8 * v21; //LOBYTE(v13) = 8 * v21 | OBJECT_Actor; - *a2 = 8 * v21 | OBJECT_Actor; + *a2 = PID(OBJECT_Actor, v21); } if (pParty->Invisible())