Mercurial > mm7
comparison Actor.cpp @ 1303:dcc52e17b517
m
author | Ritor1 |
---|---|
date | Sun, 23 Jun 2013 14:02:07 +0600 |
parents | fac7751b2dc9 |
children | 13b7be8b06a0 |
comparison
equal
deleted
inserted
replaced
1286:d8033eb56d7e | 1303:dcc52e17b517 |
---|---|
31 #include "GUIWindow.h" | 31 #include "GUIWindow.h" |
32 #include "GUIFont.h" | 32 #include "GUIFont.h" |
33 | 33 |
34 #include "MM7.h" | 34 #include "MM7.h" |
35 #include "SpriteObject.h" | 35 #include "SpriteObject.h" |
36 #include "Allocator.h" | |
37 #include "PaletteManager.h" | |
36 | 38 |
37 | 39 |
38 | 40 |
39 | 41 |
40 | 42 |
3977 LOBYTE(result) = PID(OBJECT_Actor,v24); | 3979 LOBYTE(result) = PID(OBJECT_Actor,v24); |
3978 v8->uSummonerID = result; | 3980 v8->uSummonerID = result; |
3979 } | 3981 } |
3980 return result; | 3982 return result; |
3981 } | 3983 } |
3984 //----- (004BBF61) -------------------------------------------------------- | |
3985 void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z) | |
3986 { | |
3987 size_t v4; // esi@1 | |
3988 int monster_id; // edi@1 | |
3989 __int16 v6; // ax@4 | |
3990 Actor *v7; // esi@5 | |
3991 int v8; // eax@5 | |
3992 MonsterInfo *v9; // edi@5 | |
3993 MonsterDesc *v10; // ebx@5 | |
3994 unsigned __int16 *v11; // ebx@5 | |
3995 int v12; // ebx@7 | |
3996 int v13; // eax@8 | |
3997 __int16 x_; // [sp+8h] [bp-Ch]@1 | |
3998 __int16 v15; // [sp+Ch] [bp-8h]@1 | |
3999 __int16 v16; // [sp+10h] [bp-4h]@3 | |
4000 signed int ya; // [sp+1Ch] [bp+8h]@5 | |
4001 | |
4002 v4 = uNumActors; | |
4003 monster_id = a1; | |
4004 x_ = x; | |
4005 v15 = a1; | |
4006 if ( (signed int)uNumActors < 500 | |
4007 && ((signed int)pAllocator->uBigBufferSizeAligned >> 10) - ((signed int)pAllocator->uNextFreeOffsetInBigBuffer >> 10) >= 2000 ) | |
4008 { | |
4009 v16 = 0; | |
4010 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
4011 { | |
4012 v6 = pIndoor->GetSector(x, y, z); | |
4013 v4 = uNumActors; | |
4014 v16 = v6; | |
4015 } | |
4016 v7 = &pActors[v4]; | |
4017 v7->Reset(); | |
4018 v8 = monster_id; | |
4019 v9 = &pMonsterStats->pInfos[monster_id]; | |
4020 v10 = &pMonsterList->pMonsters[v8 - 1]; | |
4021 strcpy(v7->pActorName, v9->pName); | |
4022 v7->sCurrentHP = LOWORD(v9->uHP); | |
4023 memcpy(&v7->pMonsterInfo, v9, 0x58u); | |
4024 v7->word_000086_some_monster_id = v15; | |
4025 v7->uActorRadius = v10->uMonsterRadius; | |
4026 v7->uActorHeight = v10->uMonsterHeight; | |
4027 v7->uMovementSpeed = v10->uMovementSpeed; | |
4028 v7->vInitialPosition.x = x_; | |
4029 v7->vPosition.x = x_; | |
4030 BYTE2(v7->uAttributes) |= 8u; | |
4031 v7->pMonsterInfo.uTreasureType = 0; | |
4032 v7->pMonsterInfo.uTreasureLevel = 0; | |
4033 v7->pMonsterInfo.uTreasureDiceSides = 0; | |
4034 v7->pMonsterInfo.uTreasureDiceRolls = 0; | |
4035 v7->pMonsterInfo.uTreasureDropChance = 0; | |
4036 v7->vInitialPosition.y = y; | |
4037 v7->vPosition.y = y; | |
4038 v7->vInitialPosition.z = z; | |
4039 v7->vPosition.z = z; | |
4040 v7->uTetherDistance = 256; | |
4041 v7->uSectorID = v16; | |
4042 v7->uGroup = 1; | |
4043 v7->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
4044 v7->PrepareSprites(0); | |
4045 v11 = v10->pSoundSampleIDs; | |
4046 ya = 4; | |
4047 do | |
4048 { | |
4049 pSoundList->LoadSound((signed __int16)*v11, 0); | |
4050 ++v11; | |
4051 --ya; | |
4052 } | |
4053 while ( ya ); | |
4054 v12 = 0; | |
4055 do | |
4056 LOWORD(v13) = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v9->uSpell1ID], 1u); | |
4057 while ( v13 ); | |
4058 ++uNumActors; | |
4059 } | |
4060 } | |
4061 //----- (00450B0A) -------------------------------------------------------- | |
4062 bool __fastcall SpawnActor(unsigned int uMonsterID) | |
4063 { | |
4064 unsigned int v1; // ebx@1 | |
4065 bool result; // eax@2 | |
4066 MonsterDesc *v3; // esi@5 | |
4067 MonsterInfo *v4; // edi@5 | |
4068 Vec3_int_ v5; // ST08_12@5 | |
4069 unsigned int v6; // ecx@5 | |
4070 Actor *v7; // eax@7 | |
4071 Actor actor; // [sp+4h] [bp-350h]@5 | |
4072 Vec3_int_ pOut; // [sp+348h] [bp-Ch]@5 | |
4073 | |
4074 v1 = uMonsterID; | |
4075 if ( uNumActors == 499 ) | |
4076 { | |
4077 result = 0; | |
4078 } | |
4079 else | |
4080 { | |
4081 if ( (signed int)uMonsterID >= (signed int)pMonsterList->uNumMonsters ) | |
4082 v1 = 0; | |
4083 v3 = &pMonsterList->pMonsters[v1]; | |
4084 v4 = &pMonsterStats->pInfos[v1 + 1]; | |
4085 memset(&actor, 0, 0x344u); | |
4086 strcpy(actor.pActorName, v4->pName); | |
4087 actor.sCurrentHP = LOWORD(v4->uHP); | |
4088 memcpy(&actor.pMonsterInfo, &pMonsterStats->pInfos[v1 + 1], 0x58u); | |
4089 actor.word_000086_some_monster_id = v1 + 1; | |
4090 actor.uActorRadius = v3->uMonsterRadius; | |
4091 actor.uActorHeight = v3->uMonsterHeight; | |
4092 actor.uMovementSpeed = v3->uMovementSpeed; | |
4093 v5 = pParty->vPosition; | |
4094 Vec3_int_::Rotate(200, pParty->sRotationY, 0, v5, &pOut.x, &pOut.z, &pOut.y); | |
4095 actor.vInitialPosition.x = pOut.x; | |
4096 actor.vPosition.x = pOut.x; | |
4097 actor.uTetherDistance = 256; | |
4098 actor.vInitialPosition.y = LOWORD(pOut.z); | |
4099 actor.vPosition.y = LOWORD(pOut.z); | |
4100 actor.vInitialPosition.z = LOWORD(pOut.y); | |
4101 actor.vPosition.z = LOWORD(pOut.y); | |
4102 pSprites_LOD->DeleteSomeSprites(); | |
4103 pPaletteManager->ResetNonTestLocked(); | |
4104 v6 = uNumActors - 1; | |
4105 if ( dword_5C6DF8 == 1 ) | |
4106 { | |
4107 dword_5C6DF8 = 0; | |
4108 v6 = uNumActors++; | |
4109 } | |
4110 v7 = &pActors[v6]; | |
4111 memcpy(v7, &actor, 0x344u); | |
4112 v7->PrepareSprites(1); | |
4113 result = 1; | |
4114 } | |
4115 return result; | |
4116 } |