comparison Actor.cpp @ 1882:b3191dddab9f

Actor::AI_Stun cleaned up, commented out the body of _4031C1_update_job
author Grumpy7
date Sat, 19 Oct 2013 06:27:07 +0200
parents fa3d4b400b8d
children 7d334cc596e0
comparison
equal deleted inserted replaced
1881:fa3d4b400b8d 1882:b3191dddab9f
1823 Actor *v5; // esi@1 1823 Actor *v5; // esi@1
1824 int x; // ebx@1 1824 int x; // ebx@1
1825 int absy; // eax@1 1825 int absy; // eax@1
1826 unsigned int v9; // ebx@11 1826 unsigned int v9; // ebx@11
1827 int v10; // ebx@13 1827 int v10; // ebx@13
1828 AIDirection notInitializedBecauseShouldBeRandom; // [sp+Ch] [bp-30h]@7 1828 AIDirection doNotInitializeBecauseShouldBeRandom; // [sp+Ch] [bp-30h]@7
1829 unsigned int v16; // [sp+2Ch] [bp-10h]@1 1829 unsigned int v16; // [sp+2Ch] [bp-10h]@1
1830 int y; // [sp+30h] [bp-Ch]@1 1830 int y; // [sp+30h] [bp-Ch]@1
1831 int absx; // [sp+38h] [bp-4h]@1 1831 int absx; // [sp+38h] [bp-4h]@1
1832 1832
1833 v5 = &pActors[uActor_id]; 1833 v5 = &pActors[uActor_id];
1842 absx = absx + absy / 2; 1842 absx = absx + absy / 2;
1843 if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) 1843 if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
1844 { 1844 {
1845 if ( !uActionLength ) 1845 if ( !uActionLength )
1846 uActionLength = 256; 1846 uActionLength = 256;
1847 Actor::AI_StandOrBored(uActor_id, OBJECT_Player, uActionLength, &notInitializedBecauseShouldBeRandom); 1847 Actor::AI_StandOrBored(uActor_id, OBJECT_Player, uActionLength, &doNotInitializeBecauseShouldBeRandom);
1848 return; 1848 return;
1849 } 1849 }
1850 if ( pActors[uActor_id].pMonsterInfo.uMovementType == 3 && absx < 128 ) 1850 if ( pActors[uActor_id].pMonsterInfo.uMovementType == 3 && absx < 128 )
1851 { 1851 {
1852 Actor::AI_Stand(uActor_id, uTarget_id, 256, &notInitializedBecauseShouldBeRandom); 1852 Actor::AI_Stand(uActor_id, uTarget_id, 256, &doNotInitializeBecauseShouldBeRandom);
1853 return; 1853 return;
1854 } 1854 }
1855 absx += ((rand() & 0xF) * radius) / 16; 1855 absx += ((rand() & 0xF) * radius) / 16;
1856 v9 = (stru_5C6E00->uIntegerDoublePi - 1) & stru_5C6E00->Atan2(x, y); 1856 v9 = (stru_5C6E00->uIntegerDoublePi - 1) & stru_5C6E00->Atan2(x, y);
1857 if ( rand() % 100 < 25 ) 1857 if ( rand() % 100 < 25 )
1860 return; 1860 return;
1861 } 1861 }
1862 v10 = v9 + rand() % 256 - 128; 1862 v10 = v9 + rand() % 256 - 128;
1863 if ( abs(v10 - v5->uYawAngle) > 256 && !(v5->uAttributes & 0x200000) ) 1863 if ( abs(v10 - v5->uYawAngle) > 256 && !(v5->uAttributes & 0x200000) )
1864 { 1864 {
1865 Actor::AI_Stand(uActor_id, uTarget_id, 256, &notInitializedBecauseShouldBeRandom); 1865 Actor::AI_Stand(uActor_id, uTarget_id, 256, &doNotInitializeBecauseShouldBeRandom);
1866 return; 1866 return;
1867 } 1867 }
1868 v5->uYawAngle = v10; 1868 v5->uYawAngle = v10;
1869 if ( v5->uMovementSpeed) 1869 if ( v5->uMovementSpeed)
1870 v5->uCurrentActionLength = 32 * absx / v5->uMovementSpeed; 1870 v5->uCurrentActionLength = 32 * absx / v5->uMovementSpeed;
1876 Actor::PlaySound(uActor_id, 3u); 1876 Actor::PlaySound(uActor_id, 3u);
1877 v5->UpdateAnimation(); 1877 v5->UpdateAnimation();
1878 } 1878 }
1879 1879
1880 //----- (004031C1) -------------------------------------------------------- 1880 //----- (004031C1) --------------------------------------------------------
1881 char __fastcall Actor::_4031C1_update_job(unsigned int uActorID, signed int a2, int a3) 1881 char __fastcall Actor::_4031C1_update_job_never_gets_called(unsigned int uActorID, signed int a2, int a3) //attempted to implement something like jobs for actors, but apparently was never finished
1882 { 1882 {
1883 unsigned int v3; // edi@1 1883 return 0;
1884 /*unsigned int v3; // edi@1
1884 Actor *v4; // esi@1 1885 Actor *v4; // esi@1
1885 ActorJob *v5; // eax@1 1886 ActorJob *v5; // eax@1
1886 signed int v6; // edx@2 1887 signed int v6; // edx@2
1887 ActorJob *v7; // eax@2 1888 ActorJob *v7; // eax@2
1888 signed int v8; // edi@2 1889 signed int v8; // edi@2
1930 LOBYTE(v5) = v10; 1931 LOBYTE(v5) = v10;
1931 v4->vPosition.z = v10; 1932 v4->vPosition.z = v10;
1932 } 1933 }
1933 } 1934 }
1934 } 1935 }
1935 return (char)v5; 1936 return (char)v5;*/
1936 } 1937 }
1937 1938
1938 //----- (004030AD) -------------------------------------------------------- 1939 //----- (004030AD) --------------------------------------------------------
1939 void Actor::AI_Stun(unsigned int uActorID, signed int edx0, int arg0) 1940 void Actor::AI_Stun(unsigned int uActorID, signed int edx0, int stunRegardlessOfState)
1940 { 1941 {
1941 unsigned int v3; // edi@1
1942 Actor *v4; // ebx@1 1942 Actor *v4; // ebx@1
1943 //__int16 result; // ax@10
1944 SpriteFrame *v6; // ecx@16
1945 __int16 v7; // ax@16 1943 __int16 v7; // ax@16
1946 unsigned int v8; // ecx@16
1947 AIDirection a3; // [sp+Ch] [bp-40h]@16 1944 AIDirection a3; // [sp+Ch] [bp-40h]@16
1948 AIDirection v10; // [sp+28h] [bp-24h]@16 1945 AIDirection* v10; // [sp+28h] [bp-24h]@16
1949 unsigned int v11; // [sp+44h] [bp-8h]@1 1946
1950 signed int a2; // [sp+48h] [bp-4h]@1
1951
1952 v3 = uActorID;
1953 a2 = edx0;
1954 v4 = &pActors[uActorID]; 1947 v4 = &pActors[uActorID];
1955 v11 = uActorID; 1948 if ( v4->uAIState == Fleeing )
1956 if ( v4->uAIState == 7 )
1957 BYTE2(v4->uAttributes) |= 2u; 1949 BYTE2(v4->uAttributes) |= 2u;
1958 if ( v4->pMonsterInfo.uHostilityType != 4 ) 1950 if ( v4->pMonsterInfo.uHostilityType != 4 )
1959 { 1951 {
1960 v4->uAttributes &= 0xFFFFFFFBu; 1952 v4->uAttributes &= 0xFFFFFFFBu;
1961 v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; 1953 v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
1962 } 1954 }
1963 if ( (signed __int64)v4->pActorBuffs[1].uExpireTime > 0 ) 1955 if ( v4->pActorBuffs[1].uExpireTime > 0 )
1964 v4->pActorBuffs[1].Reset(); 1956 v4->pActorBuffs[1].Reset();
1965 if ( (signed __int64)v4->pActorBuffs[4].uExpireTime > 0 ) 1957 if ( v4->pActorBuffs[4].uExpireTime > 0 )
1966 v4->pActorBuffs[4].Reset(); 1958 v4->pActorBuffs[4].Reset();
1967 if ( arg0 1959 if ( stunRegardlessOfState
1968 || (v4->uAIState != 8 1960 || (v4->uAIState != Stunned
1969 && v4->uAIState != 3 1961 && v4->uAIState != AttackingRanged1
1970 && v4->uAIState != 12 1962 && v4->uAIState != AttackingRanged2
1971 && v4->uAIState != 13 1963 && v4->uAIState != AttackingRanged3
1972 && v4->uAIState != 18 1964 && v4->uAIState != AttackingRanged4
1973 && v4->uAIState != 2)) 1965 && v4->uAIState != AttackingMelee))
1974 { 1966 {
1975 memcpy(&v10, Actor::GetDirectionInfo(PID(OBJECT_Actor,v3), a2, &a3, 0), sizeof(v10)); 1967 v10 = Actor::GetDirectionInfo(PID(OBJECT_Actor,uActorID), edx0, &a3, 0), sizeof(v10);
1976 v6 = pSpriteFrameTable->pSpriteSFrames; 1968 v4->uYawAngle = LOWORD(v10->uYawAngle);
1977 v4->uYawAngle = LOWORD(v10.uYawAngle); 1969 v7 = pSpriteFrameTable->pSpriteSFrames[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength;
1978 v7 = v6[v4->pSpriteIDs[ANIM_GotHit]].uAnimLength;
1979 v8 = v11;
1980 v4->uCurrentActionTime = 0; 1970 v4->uCurrentActionTime = 0;
1981 v4->uAIState = Stunned; 1971 v4->uAIState = Stunned;
1982 v4->uCurrentActionLength = 8 * v7; 1972 v4->uCurrentActionLength = 8 * v7;
1983 Actor::PlaySound(v8, 2u); 1973 Actor::PlaySound(uActorID, 2u);
1984 v4->UpdateAnimation(); 1974 v4->UpdateAnimation();
1985 } 1975 }
1986 } 1976 }
1987 1977
1988 //----- (00402F87) -------------------------------------------------------- 1978 //----- (00402F87) --------------------------------------------------------
3977 if (actor->IsPeasant()) 3967 if (actor->IsPeasant())
3978 BYTE2(actor->uAttributes) &= 0xF7u; 3968 BYTE2(actor->uAttributes) &= 0xF7u;
3979 3969
3980 BYTE2(actor->uAttributes) &= 0x7Fu; 3970 BYTE2(actor->uAttributes) &= 0x7Fu;
3981 if (BYTE2(actor->uAttributes) & 0x40) 3971 if (BYTE2(actor->uAttributes) & 0x40)
3982 Actor::_4031C1_update_job(i, pParty->uCurrentHour, 1); 3972 Actor::_4031C1_update_job_never_gets_called(i, pParty->uCurrentHour, 1);
3983 } 3973 }
3984 } 3974 }
3985 //----- (00439474) -------------------------------------------------------- 3975 //----- (00439474) --------------------------------------------------------
3986 void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) 3976 void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity)
3987 { 3977 {