# HG changeset patch # User yoctozepto # Date 1378128189 -7200 # Node ID af57b3b76fe4c9d8be7e3a6824033dd70d3f1dd5 # Parent 948191fca433217df408c78c7792fc54ce5f9b71 Clean and decouple. (1) diff -r 948191fca433 -r af57b3b76fe4 DecalBuilder.h --- a/DecalBuilder.h Mon Sep 02 17:39:31 2013 +0600 +++ b/DecalBuilder.h Mon Sep 02 15:23:09 2013 +0200 @@ -1,4 +1,7 @@ #pragma once + +#include + #include "Render.h" /* 158 */ @@ -120,7 +123,7 @@ __int16 field_C0A; __int16 field_C0C; __int16 field_C0E; - uint uColorMultiplier; + uint32_t uColorMultiplier; int field_C14; DecalBuilder_stru0 *field_C18; int field_C1C; diff -r 948191fca433 -r af57b3b76fe4 GUIWindow.h --- a/GUIWindow.h Mon Sep 02 17:39:31 2013 +0600 +++ b/GUIWindow.h Mon Sep 02 15:23:09 2013 +0200 @@ -1,10 +1,9 @@ #pragma once -#include "Player.h" + +#include #include - - - +#include "Player.h" enum UIMessageType: unsigned __int32 { @@ -566,7 +565,7 @@ // transition & travel ui -void TransitionUI_Load(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName); +void TransitionUI_Load(uint32_t anim_id, uint32_t exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName); void TransitionUI_Draw(); void TravelUI_Load(); diff -r 948191fca433 -r af57b3b76fe4 Indoor.h --- a/Indoor.h Mon Sep 02 17:39:31 2013 +0600 +++ b/Indoor.h Mon Sep 02 15:23:09 2013 +0200 @@ -1,4 +1,5 @@ #pragma once + #include "Level/Decoration.h" #include "Indoor_stuff.h" diff -r 948191fca433 -r af57b3b76fe4 Indoor_stuff.h --- a/Indoor_stuff.h Mon Sep 02 17:39:31 2013 +0600 +++ b/Indoor_stuff.h Mon Sep 02 15:23:09 2013 +0200 @@ -1,4 +1,7 @@ #pragma once + +#include + #include "Render.h" #include "IndoorCameraD3D.h" diff -r 948191fca433 -r af57b3b76fe4 Level/Decoration.h --- a/Level/Decoration.h Mon Sep 02 17:39:31 2013 +0600 +++ b/Level/Decoration.h Mon Sep 02 15:23:09 2013 +0200 @@ -1,8 +1,10 @@ #pragma once -#include "../mm7_data.h" +#include -enum LEVEL_DECORATION_FLAGS: uint16 +#include "../VectorTypes.h" + +enum LEVEL_DECORATION_FLAGS: uint16_t { LEVEL_DECORATION_TRIGGERED_BY_TOUCH = 0x01, LEVEL_DECORATION_TRIGGERED_BY_MONSTER = 0x02, @@ -22,15 +24,15 @@ bool IsInteractive(); bool IsObeliskChestActive(); - uint16 uDecorationDescID; - uint16 uFlags; + uint16_t uDecorationDescID; + uint16_t uFlags; Vec3_int_ vPosition; - int32 field_10_y_rot; - uint16 uCog; - int16 field_16_event_id; - int16 field_18; - int16 field_1A; - int16 _idx_in_stru123; - int16 field_1E; + int32_t field_10_y_rot; + uint16_t uCog; + int16_t field_16_event_id; + int16_t field_18; + int16_t field_1A; + int16_t _idx_in_stru123; + int16_t field_1E; }; #pragma pack(pop) diff -r 948191fca433 -r af57b3b76fe4 Render.cpp --- a/Render.cpp Mon Sep 02 17:39:31 2013 +0600 +++ b/Render.cpp Mon Sep 02 15:23:09 2013 +0200 @@ -2103,7 +2103,7 @@ hd_water_current_frame = 0; } -bool Render::Initialize(bool bWindowed, uint uDefaultDevice, bool bColoredLights, uint uDetailLevel, uint bTinting) +bool Render::Initialize(bool bWindowed, uint32_t uDefaultDevice, bool bColoredLights, uint32_t uDetailLevel, bool bTinting) { bUserDirect3D = true;//ReadWindowsRegistryInt("Use D3D", 0); bStartInWindow = bWindowed; diff -r 948191fca433 -r af57b3b76fe4 Render.h --- a/Render.h Mon Sep 02 17:39:31 2013 +0600 +++ b/Render.h Mon Sep 02 15:23:09 2013 +0200 @@ -1,5 +1,7 @@ #pragma once -#include + +#include +#include #include "lib\legacy_dx\d3d.h" #include "OSAPI.h" @@ -169,7 +171,7 @@ HWLTexture *LoadTexture(const char *pName, int bMipMaps); FILE *pFile; - uint uSignature; + uint32_t uSignature; unsigned int uDataOffset; unsigned int uNumItems; char *pSpriteNames[50000]; @@ -267,8 +269,8 @@ static Render *Create() {return new Render;} - bool Initialize(bool bWindowed, uint uDefaultDevice, - bool bColoredLights, uint uDetailLevel, uint bTinting); + bool Initialize(bool bWindowed, uint32_t uDefaultDevice, + bool bColoredLights, uint32_t uDetailLevel, bool bTinting); bool IsColorKeySupported(IDirectDraw4 *); @@ -435,7 +437,7 @@ unsigned int uMinDeviceTextureDim; int field_10365C; unsigned int bUsingSpecular; - uint uFogColor; + uint32_t uFogColor; int field_103668; unsigned int pHDWaterBitmapIDs[7]; char field_103688[32]; @@ -447,7 +449,7 @@ int _gpu_memory_used; void ( *pBeforePresentFunction)(); int field_1036C4; - uint bFogEnabled; + uint32_t bFogEnabled; int field_1036CC; RenderBillboardD3D pBillboardRenderListD3D[1000]; unsigned int uNumBillboardsToDraw; diff -r 948191fca433 -r af57b3b76fe4 VectorTypes.h --- a/VectorTypes.h Mon Sep 02 17:39:31 2013 +0600 +++ b/VectorTypes.h Mon Sep 02 15:23:09 2013 +0200 @@ -1,7 +1,5 @@ #pragma once -typedef unsigned __int32 uint; - #pragma pack(push, 1) struct Vec2_short_ { @@ -11,34 +9,6 @@ #pragma pack(pop) #pragma pack(push, 1) -struct Vec3_float_ -{ - void Normalize(); - - -//----- (0049B32D) -------------------------------------------------------- -static Vec3_float_ *Vec3_float_::Cross(Vec3_float_ *v1, Vec3_float_ *pOut, float x, float y, float z) -{ - pOut->x = z * v1->y - y * v1->z; - pOut->y = x * v1->z - z * v1->x; - pOut->z = y * v1->x - x * v1->y; - return pOut; -} - - //----- (0049B02E) -------------------------------------------------------- - inline static float NegDot(Vec3_float_ *a1, Vec3_float_ *a2, float *a3) - { - return *a3 = -(a1->z * a2->z + a1->y * a2->y + a1->x * a2->x); - } - - float x; - float y; - float z; -}; -#pragma pack(pop) - - -#pragma pack(push, 1) struct Vec2_int_ { int x; @@ -54,7 +24,6 @@ }; #pragma pack(pop) - #pragma pack(push, 1) struct Vec3_short_ { @@ -67,10 +36,7 @@ #pragma pack(push, 1) struct Vec3_int_ { - inline Vec3_int_(): - x(0), y(0), z(0) - {} - inline Vec3_int_(int a, int b = 0, int c = 0): + inline Vec3_int_(int a = 0, int b = 0, int c = 0): x(a), y(b), z(c) {} @@ -86,6 +52,32 @@ #pragma pack(pop) #pragma pack(push, 1) +struct Vec3_float_ +{ + void Normalize(); + + //----- (0049B32D) -------------------------------------------------------- + static Vec3_float_ *Vec3_float_::Cross(Vec3_float_ *v1, Vec3_float_ *pOut, float x, float y, float z) + { + pOut->x = z * v1->y - y * v1->z; + pOut->y = x * v1->z - z * v1->x; + pOut->z = y * v1->x - x * v1->y; + return pOut; + } + + //----- (0049B02E) -------------------------------------------------------- + inline static float NegDot(Vec3_float_ *a1, Vec3_float_ *a2, float *a3) + { + return *a3 = -(a1->z * a2->z + a1->y * a2->y + a1->x * a2->x); + } + + float x; + float y; + float z; +}; +#pragma pack(pop) + +#pragma pack(push, 1) struct Vec4_int_ { int x; @@ -95,11 +87,6 @@ }; #pragma pack(pop) - - - - - /* 82 */ #pragma pack(push, 1) struct Plane_int_ @@ -109,7 +96,6 @@ }; #pragma pack(pop) - #pragma pack(push, 1) struct BBox_short_ { @@ -142,9 +128,6 @@ }; #pragma pack(pop) - - - /* 196 */ #pragma pack(push, 1) struct Matrix3x3_float_ @@ -161,4 +144,3 @@ }; }; #pragma pack(pop) -