Batch #14943 by ragnarok-clanker: no function's compiled code changes; checked with 741 compiled unit(s), including every includer of Source/ActorPickNode.h, Source/Client/Browser/BrowserClientSite.h, Source/Client/Browser/BrowserPopupDispatch.h, Source/Client/Mode/CGameMode.h, Source/Client/Mode/CLoginMode.h, Source/Client/Mode/CMode.h, Source/Client/Mode/ModeDragState.h, Source/Client/Replay.h, Source/Client/Session.h, Source/Client/Stove/StoveMgr.h, Source/Contents/AchievementMgr.h, Source/Contents/ActorNameCard.h, Source/Contents/Actors/CharacterRender.h, Source/Contents/Actors/EffectActors.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/GrannyGameActor.h, Source/Contents/Actors/GroundScope.h, Source/Contents/Actors/Item.h, Source/Contents/Actors/Npc.h, Source/Contents/Actors/Pc.h, Source/Contents/Actors/RenderObjectState.h, Source/Contents/Actors/Skill.h, Source/Contents/AdventureGuideMgr.h, Source/Contents/Camera/Camera.h, Source/Contents/Camera/CameraState.h, Source/Contents/CashEmotionMgr.h, Source/Contents/Configuration/GameSettingsMgr.h, Source/Contents/EffectResourceSwitcher.h, Source/Contents/Effects/AMachineEffect.h, Source/Contents/Effects/AcidifiedThrow.h, Source/Contents/Effects/AxeBoomerang.h, Source/Contents/Effects/BlastForge.h, Source/Contents/Effects/CaneOfEvilEyeEffect.h, Source/Contents/Effects/CharacterParticleBundle.h, Source/Contents/Effects/CloudKillEffect.h, Source/Contents/Effects/Effect.h, Source/Contents/Effects/EffectActor.h, Source/Contents/Effects/EffectEmitter.h, Source/Contents/Effects/EffectMaker.h, Source/Contents/Effects/EffectPrimitiveState.h, Source/Contents/Effects/FuumaShouakuEffect.h, Source/Contents/Effects/GravityControlEffect.h, Source/Contents/Effects/HealSpEffect.h, Source/Contents/Effects/Level99Effect.h, Source/Contents/Effects/MapChainEffect.h, Source/Contents/Effects/MonsterSkillEffects.h, Source/Contents/Effects/MsgEffect.h, Source/Contents/Effects/NyanggrassEffect.h, Source/Contents/Effects/Particle.h, Source/Contents/Effects/PowderingEffect.h, Source/Contents/Effects/RagEffectState.h, Source/Contents/Effects/RectUpEffect.h, Source/Contents/Effects/ShadowExceedEffect.h, Source/Contents/Effects/SkillEffects.h, Source/Contents/Effects/SpriteParticle.h, Source/Contents/Effects/StormCannonEffect.h, Source/Contents/Effects/ThrowEffects.h, Source/Contents/EntryQueueMgr.h, Source/Contents/EquipmentResourceMgr.h, Source/Contents/FlyingShipRouteInfo.h, Source/Contents/Ground/GroundGeometry.h, Source/Contents/GuildInfo.h, Source/Contents/Items/ItemDescription.h, Source/Contents/Items/ItemInfo.h, Source/Contents/MapSkyMgr.h, Source/Contents/Messenger/MessengerWindows.h, Source/Contents/Models/ModelNode.h, Source/Contents/NavigationManager.h, Source/Contents/Party/AdventurerAgencyMgr.h, Source/Contents/RDamageVar.h, Source/Contents/RenewQuestMgr.h, Source/Contents/ReputeMgr.h, Source/Contents/RodexMailStore.h, Source/Contents/RouletteMgr.h, Source/Contents/Schedule/Schedule.h, Source/Contents/SignBoard/SignBoard.h, Source/Contents/Skills/ClientSkills.h, Source/Contents/Skills/PlayerSkillBundle.h, Source/Contents/Skills/SkillInfo.h, Source/Contents/SpriteLayerDrawing.h, Source/Contents/TipBoxTitles.h, Source/Contents/UserData/AccountLinkedUserDataMgr.h, Source/Contents/UserData/NormalItemSlots.h, Source/Contents/World/World.h, Source/Contents/WorldView/WorldViewData.h, Source/Render/Primitives/LightmappedPrimitive.h, Source/Render/Primitives/RenderPrimitive.h, Source/Render/Renderer.h, Source/Render/Textures/SpritePixels.h, Source/Render/Textures/Texture.h, Source/Resource/EZeffectResource.h, Source/Resource/Models/AnimatedModelResource.h, Source/Resource/Models/GrannyModelResource.h, Source/Resource/Sprites/ActionResource.h, Source/Resource/World/GroundResource.h, Source/Resource/World/WorldResource.h, Source/Resource/XmlNode.h, Source/UI/AdventureGuide/UIAdventureGuide.h, Source/UI/Buttons/UIBmpRadioBtn.h, Source/UI/Buttons/UIDescriptRace.h, Source/UI/Buttons/UIItemTagButton.h, Source/UI/Buttons/UISlotBmpButton.h, Source/UI/Buttons/UISpriteButton.h, Source/UI/Buttons/UITVTextButton.h, Source/UI/Buttons/UITextureButton.h, Source/UI/CashEmotion/UICashEmotionListWnd.h, Source/UI/CashEmotion/UICashEmotionPack.h, Source/UI/CashShop/UICashShopWnd.h, Source/UI/Chat/UIChatRoomMakeWnd.h, Source/UI/Chat/UIChatRoomTitle.h, Source/UI/Chat/UINewChatWnd.h, Source/UI/Chat/UISubChatHisWnd.h, Source/UI/Chat/UISubChatMiniWnd.h, Source/UI/Chat/UIWhisperWnd.h, Source/UI/Clan/UIClanWnd.h, Source/UI/Dialogs/UIBookWnd.h, Source/UI/Dialogs/UIChooseWarpWnd.h, Source/UI/Dialogs/UIMenuWnd.h, Source/UI/Dialogs/UIMiniMapWnd.h, Source/UI/Dialogs/UIMinimapZoomWnd.h, Source/UI/Dialogs/UINpcEditDialogWnd.h, Source/UI/Dialogs/UIPasswordWnd.h, Source/UI/Dialogs/UISayDialogWnd.h, Source/UI/Dialogs/UISelectCartWnd.h, Source/UI/Dialogs/UITipboxWnd.h, Source/UI/Edit/UIEditBoxEx.h, Source/UI/Edit/UIEditCtrl.h, Source/UI/Edit/UIEditCtrl_Currency.h, Source/UI/Edit/UIItemTagCtrl.h, Source/UI/Enchant/EnchantUI.h, Source/UI/Exchange/UIExchangeUI.h, Source/UI/FrameSkin.h, Source/UI/GameSettings/GameSettingsUI.h, Source/UI/Gauges/UIPcGage.h, Source/UI/Guild/UIGuildHelperWnd.h, Source/UI/Guild/UIGuildWnd.h, Source/UI/Guild/UIGuild_Storage_Log.h, Source/UI/Item/UIEquipmentPropertiesWnd.h, Source/UI/Item/UIItemBaseWnd.h, Source/UI/Item/UIItemPurchaseWnd.h, Source/UI/Item/UIItemSellWnd2.h, Source/UI/Item/UIItemShopWnd.h, Source/UI/Item/UIItemShopWnd2.h, Source/UI/Item/UIItemStoreFindWnd.h, Source/UI/Item/UIItemStoreSubWnd.h, Source/UI/Item/UIItemStoreWnd.h, Source/UI/Item/UIItemWnd.h, Source/UI/Item/UIMerchantItemLogWnd.h, Source/UI/Item/UIParaItemShopWnd.h, Source/UI/Items/UICardItemIllustWnd.h, Source/UI/Items/UIEquipWnd.h, Source/UI/Items/UIExchangeWnd.h, Source/UI/Items/UIGameItem.h, Source/UI/Items/UIItemCollectionWnd.h, Source/UI/Items/UIItemIdentifyWnd.h, Source/UI/Items/UIItemParamChangeDisplayWnd.h, Source/UI/Items/UISwapEquipmentWnd.h, Source/UI/Layout/WindowGeometry.h, Source/UI/Lists/UIChatHisBox.h, Source/UI/Lists/UIComboBoxV2Wnd.h, Source/UI/Lists/UIImgMenu.h, Source/UI/Lists/UIListBoxID.h, Source/UI/Lists/UIListBoxTemplate.h, Source/UI/Lists/UIMemberListBox.h, Source/UI/Lists/UITabControl.h, Source/UI/Lists/UITagListBox.h, Source/UI/Lists/UITreeView.h, Source/UI/Menu/UIMenuIconWnd.h, Source/UI/Navigation/UINavigationV4Wnd.h, Source/UI/ProbabilityTable/UIProbabilityTable.h, Source/UI/Quest/UIQuestDisplay.h, Source/UI/Quest/UIRenewQuestUI.h, Source/UI/Quest/UIRenewQuestWnd.h, Source/UI/Rodex/UIRodexComposeWnd.h, Source/UI/Rodex/UIRodexInboxWnd.h, Source/UI/RuneSystem/UIRuneSystemWindows.h, Source/UI/RuneSystem/UIRuneSystemWnd.h, Source/UI/Shop/UIMerchantItemMyShopWnd.h, Source/UI/Shop/UIMerchantItemPurchaseMSGWnd.h, Source/UI/Shop/UIMerchantItemPurchaseWnd.h, Source/UI/Shop/UIMerchantItemShopWnd.h, Source/UI/Shop/UIMerchantMirrorItemWnd.h, Source/UI/Shop/UIMerchantShopMakeWnd.h, Source/UI/Shop/UIMerchantShopTitle.h, Source/UI/Skill/UISkillDescribeWnd.h, Source/UI/Skill/UISkillListWnd.h, Source/UI/SkillDelayInfo/SkillDelayInfo.h, Source/UI/StylingShop/UIStylingShopWnd.h, Source/UI/Text/CreateLineInfo.h, Source/UI/Text/UIAchWnd.h, Source/UI/Text/UIBalloonText.h, Source/UI/Text/UINameBalloonText.h, Source/UI/Text/UIStaticTextControl.h, Source/UI/Text/UIString.h, Source/UI/Text/UITextViewerControl.h, Source/UI/UIBarGraph.h, Source/UI/UIBartermarketWnd.h, Source/UI/UIChangeMaterialWnd.h, Source/UI/UIGradeEnchantWnd.h, Source/UI/UILapineScrollBar.h, Source/UI/UIMacroBlackListCheckWnd.h, Source/UI/UIMacroDetectorWnd.h, Source/UI/UIMacroReport.h, Source/UI/UIMacroUserInfoWnd.h, Source/UI/UIPreviewEquipWnd.h, Source/UI/UIRefiningWnd.h, Source/UI/UIScrollWnd.h, Source/UI/UISlotBitmap.h, Source/UI/Window/FuncDrawWNDChar.h, Source/UI/Window/UIBattleMsgOptionWnd.h, Source/UI/Window/UIChatRoomWnd.h, Source/UI/Window/UICollectionSystemWnd.h, Source/UI/Window/UIControl.h, Source/UI/Window/UIHomunInfoWnd.h, Source/UI/Window/UIHotKeyWnd.h, Source/UI/Window/UIJobListWnd.h, Source/UI/Window/UILoginOTPWnd.h, Source/UI/Window/UILoginWnd.h, Source/UI/Window/UIMakeCharWnd.h, Source/UI/Window/UIMonsterDisplayWnd.h, Source/UI/Window/UIMonsterInfoWnd.h, Source/UI/Window/UINavigationHelpWnd.h, Source/UI/Window/UINavigationWnd.h, Source/UI/Window/UINewMakeCharWnd.h, Source/UI/Window/UINewSelectCharWnd.h, Source/UI/Window/UINoticeWnd.h, Source/UI/Window/UIPetInfoWnd.h, Source/UI/Window/UIRegisterMgr.h, Source/UI/Window/UIRoMapWnd.h, Source/UI/Window/UIRodexContentsWnd.h, Source/UI/Window/UISecondCostumeWnd.h, Source/UI/Window/UISeekPartyMBWnd.h, Source/UI/Window/UISeekPartyWnd.h, Source/UI/Window/UISelCharForUServerWnd.h, Source/UI/Window/UISerachStoreInfoWnd.h, Source/UI/Window/UITransMenuWnd.h, Source/UI/Window/UIWindow.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl, Source/Utility/Lexicon/LexiconSerializer.h.
290 lines
9 KiB
C++
290 lines
9 KiB
C++
#include "UI/Window/UIEnums.h"
|
|
#include "Client/Mode/ModeMessage.h"
|
|
#include "Client/Application/ApplicationMessages.h"
|
|
#include "Contents/Models/ModelActor.h"
|
|
#include "Contents/Ground/TerrainHeight.h"
|
|
#include "Contents/World/WorldModelLoading.h"
|
|
#include "Contents/World/WorldSpatialInitialization.h"
|
|
#include "Resource/ResourceMgr.h"
|
|
#include "Resource/World/WorldResource.h"
|
|
|
|
#include "Client/Application/ErrorDialog.h"
|
|
#include "Client/Mode/CGameMode.h"
|
|
#include "Client/Mode/ModeMgr.h"
|
|
#include "Client/Session.h"
|
|
#include "Contents/Actors/Pc.h"
|
|
#include "Contents/Ground/GroundGeometry.h"
|
|
#include "Contents/Ground/GroundWaterState.h"
|
|
#include "Contents/Movies/BinkMovies.h"
|
|
#include "Contents/World/World.h"
|
|
#include "Render/Renderer.h"
|
|
#include "Resource/World/GroundResource.h"
|
|
#include "Resource/World/TerrainResource.h"
|
|
#include "UI/Window/UIWindowMgr.h"
|
|
|
|
#include <algorithm>
|
|
#include <atomic>
|
|
#include <cmath>
|
|
#include <cstdint>
|
|
#include <cstring>
|
|
#include <timeapi.h>
|
|
#include <windows.h>
|
|
|
|
|
|
// GLOBAL: gl_24754
|
|
float g_worldLightDirection[3];
|
|
|
|
// GLOBAL: gl_24755
|
|
float g_worldDiffuse[3];
|
|
|
|
// GLOBAL: gl_24756
|
|
float g_worldAmbient[3];
|
|
|
|
// GLOBAL: gl_24758
|
|
float g_worldLoadCenter[3];
|
|
|
|
namespace {
|
|
// INLINED
|
|
bool Before(const DeferredWorldModel& left, const DeferredWorldModel& right) {
|
|
if (left.distance < right.distance) {
|
|
return true;
|
|
}
|
|
|
|
if (right.distance < left.distance) {
|
|
return false;
|
|
}
|
|
|
|
if (left.distance == right.distance) {
|
|
return reinterpret_cast<std::uintptr_t>(left.placement) < reinterpret_cast<std::uintptr_t>(right.placement);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
// INLINED
|
|
inline C3dActor* CreateWorldModel(const WorldModelRecord& placement, C3dModelRes& resource, BinkMovies& movies) {
|
|
resource.RegisterMovies(movies, placement.position);
|
|
|
|
if (!resource.FindNode(placement.node) && resource.nodes.empty()) {
|
|
return nullptr;
|
|
}
|
|
|
|
C3dActor* actor = nullptr;
|
|
|
|
if (resource.major == 1) {
|
|
actor = new C3dActorV1;
|
|
} else if (resource.major == 2) {
|
|
actor = new C3dActorV2;
|
|
}
|
|
|
|
actor->CopyVolumes(resource.volumes);
|
|
actor->SetSpeed(placement.animationSpeed);
|
|
actor->playback = placement.animation;
|
|
std::memcpy(actor->position, placement.position, sizeof(actor->position));
|
|
actor->dirty = 1;
|
|
std::memcpy(actor->rotation, placement.rotation, sizeof(actor->rotation));
|
|
actor->dirty = 1;
|
|
std::memcpy(actor->scale, placement.scale, sizeof(actor->scale));
|
|
actor->dirty = 1;
|
|
actor->commandMode = placement.flag;
|
|
actor->color = static_cast<std::uint32_t>(placement.index);
|
|
actor->Assign(resource);
|
|
actor->occlusionEnabled = 0;
|
|
actor->Prepare(g_worldLightDirection, g_worldDiffuse, g_worldAmbient);
|
|
|
|
return actor;
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00AC8BF0
|
|
// FUNCTION: fn_17680
|
|
DWORD WINAPI CWorld::LoadDeferredModels(void* parameter) {
|
|
CWorld* world = static_cast<CWorld*>(parameter);
|
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
|
std::sort(g_deferredWorldModels.begin(), g_deferredWorldModels.end(), Before);
|
|
|
|
for (const DeferredWorldModel& entry : g_deferredWorldModels) {
|
|
const WorldModelRecord& placement = *entry.placement;
|
|
auto* resource = static_cast<C3dModelRes*>(ResourceMgr::Instance().Load(placement.model));
|
|
|
|
if (!resource) {
|
|
continue;
|
|
}
|
|
|
|
C3dActor* model = CreateWorldModel(placement, *resource, *world->movies);
|
|
|
|
if (!model) {
|
|
continue;
|
|
}
|
|
|
|
world->models.push_back(model);
|
|
std::atomic_ref<int>(world->pending).fetch_add(1, std::memory_order_seq_cst);
|
|
Sleep(0);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
// OFFSET: 0x00ACB6C0
|
|
// FUNCTION: fn_17705
|
|
void CWorld::FinishModelLoading() {
|
|
if (hObject) {
|
|
WaitForSingleObject(hObject, INFINITE);
|
|
CloseHandle(hObject);
|
|
hObject = nullptr;
|
|
}
|
|
|
|
g_deferredWorldModels.clear();
|
|
std::atomic_ref<int>(this->pending).store(0, std::memory_order_release);
|
|
}
|
|
|
|
// OFFSET: 0x00AC94C0
|
|
// FUNCTION: fn_17684
|
|
void CWorld::InitWorld() {
|
|
const auto ErrorDialog = reinterpret_cast<int (*)(const char*, UINT)>(
|
|
static_cast<int (*)(CRenderSystemBase*, const char*, UINT)>(&ShowErrorDialog)
|
|
);
|
|
|
|
const char* rawMapName = reinterpret_cast<const char*>(this->gameMode->SendMsg(MM_QUERYRSWNAME, 0, 0, 0, 0));
|
|
std::string mapName(rawMapName ? rawMapName : "");
|
|
|
|
auto* worldRes = static_cast<C3dWorldRes*>(ResourceMgr::Instance().Load(mapName.c_str()));
|
|
if (!worldRes) {
|
|
ErrorDialog("world\xbf\xa1 NULL\xb0\xaa\xc0\xcc \xb5\xe9\xbe\xee\xbf\xd4\xbd\xc0\xb4\xcf\xb4\xd9", 0);
|
|
return;
|
|
}
|
|
|
|
this->movies = new BinkMovies();
|
|
this->serializedSpatial = worldRes->spatial;
|
|
|
|
int* modeBounds = reinterpret_cast<int*>(this->gameMode->areaBounds);
|
|
modeBounds[0] = worldRes->bounds[2];
|
|
modeBounds[1] = worldRes->bounds[3];
|
|
modeBounds[2] = worldRes->bounds[0];
|
|
modeBounds[3] = worldRes->bounds[1];
|
|
|
|
g_worldLightDirection[0] = worldRes->lightDirection[0];
|
|
g_worldLightDirection[1] = worldRes->lightDirection[1];
|
|
g_worldLightDirection[2] = worldRes->lightDirection[2];
|
|
g_worldDiffuse[0] = worldRes->diffuse[0];
|
|
g_worldDiffuse[1] = worldRes->diffuse[1];
|
|
g_worldDiffuse[2] = worldRes->diffuse[2];
|
|
g_worldAmbient[0] = worldRes->ambient[0];
|
|
g_worldAmbient[1] = worldRes->ambient[1];
|
|
g_worldAmbient[2] = worldRes->ambient[2];
|
|
|
|
g_renderer->twoPass = worldRes->flag;
|
|
g_renderer->SetLighting(g_worldLightDirection, g_worldDiffuse, g_worldAmbient);
|
|
|
|
if (worldRes->terrainName.empty()) {
|
|
ErrorDialog("attr \xc6\xc4\xc0\xcf\xc0\xcc rsw \xb3\xbb\xbf\xa1 \xc1\xf6\xc1\xa4\xb5\xc7\xbe\xee \xc0\xd6\xc1\xf6 \xbe\xca\xbd\xc0\xb4\xcf\xb4\xd9", 0);
|
|
return;
|
|
}
|
|
|
|
this->terrain = static_cast<C3dAttr*>(ResourceMgr::Instance().Load(worldRes->terrainName.c_str()));
|
|
if (!this->terrain) {
|
|
ErrorDialog("attr \xc6\xc4\xc0\xcf \xc0\xd0\xb1\xe2\xbf\xa1 \xbd\xc7\xc6\xd0", 0);
|
|
return;
|
|
}
|
|
|
|
this->terrain->cellSize = 5;
|
|
this->nearbyRange = this->terrain->cellSize * this->nearbyRange;
|
|
|
|
if (worldRes->groundName.empty()) {
|
|
ErrorDialog("gnd \xc6\xc4\xc0\xcf\xc0\xcc rsw \xb3\xbb\xbf\xa1 \xc1\xf6\xc1\xa4\xb5\xc7\xbe\xee \xc0\xd6\xc1\xf6 \xbe\xca\xbd\xc0\xb4\xcf\xb4\xd9", 0);
|
|
return;
|
|
}
|
|
|
|
auto* groundRes = static_cast<CGndRes*>(ResourceMgr::Instance().Load(worldRes->groundName.c_str()));
|
|
if (!groundRes) {
|
|
ErrorDialog("ground\xbf\xa1 NULL\xc0\xcc \xb5\xe9\xbe\xee\xbf\xd4\xbd\xc0\xb4\xcf\xb4\xd9.", 0);
|
|
return;
|
|
}
|
|
|
|
if (groundRes->loaded == 0) {
|
|
ErrorDialog("\xb8\xca\xc0\xcc \xbf\xbe \xb9\xf6\xc1\xaf\xc0\xd4\xb4\xcf\xb4\xd9", 0);
|
|
return;
|
|
}
|
|
|
|
this->ground = new GroundGeometry();
|
|
this->ground->Build(*groundRes, g_worldLightDirection, g_worldDiffuse, g_worldAmbient);
|
|
this->ground->terrain = this->terrain;
|
|
|
|
this->ground->SetWater(
|
|
worldRes->waterLevel,
|
|
worldRes->waterType,
|
|
worldRes->waterAnimation,
|
|
static_cast<int>(worldRes->wavePitch),
|
|
static_cast<int>(worldRes->waveSpeed),
|
|
worldRes->waveHeight
|
|
);
|
|
|
|
this->ground->ImportWater(*groundRes);
|
|
|
|
ResourceMgr::Instance().Remove(groundRes);
|
|
|
|
const std::size_t modelCount = worldRes->models.size();
|
|
this->models.clear();
|
|
if (this->models.capacity() < modelCount) {
|
|
this->models.reserve(modelCount);
|
|
}
|
|
|
|
DWORD lastNoticeTime = 0;
|
|
int lastPercent = -1;
|
|
int progress = 0;
|
|
|
|
for (const WorldModelRecord* placement : worldRes->models) {
|
|
progress += 100;
|
|
DWORD now = timeGetTime();
|
|
int percent = static_cast<int>(progress / modelCount);
|
|
if ((percent != lastPercent && now - lastNoticeTime > 15) || percent == 100) {
|
|
lastPercent = percent;
|
|
lastNoticeTime = now;
|
|
g_windowMgr.SendNotice(UIM_LOADINGPERCENT, percent, 0, 0, 0, 0);
|
|
g_windowMgr.CenterSurface0478();
|
|
g_windowMgr.DrawWindows();
|
|
if (g_renderer->Draw()) {
|
|
g_renderer->Present(0);
|
|
}
|
|
PumpApplicationMessages();
|
|
}
|
|
|
|
static_cast<CGameMode*>(g_modeMgr.GetGameMode())
|
|
->CellCenter(g_session.m_playerX, g_session.m_playerY, g_worldLoadCenter[0], g_worldLoadCenter[2]);
|
|
|
|
const float dx = placement->position[0] - g_worldLoadCenter[0];
|
|
const float dy = placement->position[1] - g_worldLoadCenter[1];
|
|
const float dz = placement->position[2] - g_worldLoadCenter[2];
|
|
const float squared = dy * dy + dx * dx + dz * dz;
|
|
const float distance = std::sqrt(squared);
|
|
|
|
if (distance > 200.0f) {
|
|
g_deferredWorldModels.push_back({distance, placement});
|
|
} else {
|
|
auto* modelRes = static_cast<C3dModelRes*>(ResourceMgr::Instance().Load(placement->model));
|
|
if (modelRes) {
|
|
if (C3dActor* actor = CreateWorldModel(*placement, *modelRes, *this->movies)) {
|
|
this->models.push_back(actor);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
this->InitializeSpatial();
|
|
this->LoadMapEffects();
|
|
|
|
this->ground->InitializeLighting();
|
|
|
|
this->published = static_cast<int>(this->models.size());
|
|
|
|
DWORD threadId = 0;
|
|
hObject = CreateThread(nullptr, 0, &CWorld::LoadDeferredModels, this, 0, &threadId);
|
|
if (!hObject) {
|
|
CWorld::LoadDeferredModels(this);
|
|
this->FinishModelLoading();
|
|
}
|
|
|
|
this->player = new CPlayer();
|
|
this->objects.push_back(this->player);
|
|
g_partyEffectNoticePending = 0;
|
|
}
|