From 8d10d45328b4c69a169bcbca311baa3b6424dd35 Mon Sep 17 00:00:00 2001 From: Michael Chaban Date: Tue, 25 Sep 2018 00:04:50 +0300 Subject: [PATCH] rearranged FEATURE defines --- 3dsystem/3d_gen.cpp | 36 +++++++++++++++++------------------- 3dsystem/scalespr.cpp | 14 +++++++------- game/health.cpp | 40 ++++++++++++++++++++-------------------- game/invtext.cpp | 18 +++++++++--------- game/text.cpp | 18 +++++++++--------- global/features.h | 7 ++----- modding/psx_bar.cpp | 4 ++-- specific/frontend.cpp | 6 +++--- specific/input.cpp | 6 +++--- specific/option.cpp | 6 +++--- specific/output.cpp | 41 +++++++++++++++++++---------------------- specific/smain.cpp | 33 +++++++++++++-------------------- 12 files changed, 107 insertions(+), 122 deletions(-) diff --git a/3dsystem/3d_gen.cpp b/3dsystem/3d_gen.cpp index d4a6fba..74769fb 100644 --- a/3dsystem/3d_gen.cpp +++ b/3dsystem/3d_gen.cpp @@ -28,10 +28,6 @@ #include "specific/hwr.h" #include "global/vars.h" -#ifdef FEATURE_FOV_FIX -bool PsxFovEnabled; -#endif // FEATURE_FOV_FIX - // related to POLYTYPE enum static void (__cdecl *PolyDrawRoutines[])(__int16 *) = { draw_poly_gtmap, // gouraud shaded poly (texture) @@ -45,7 +41,9 @@ static void (__cdecl *PolyDrawRoutines[])(__int16 *) = { draw_scaled_spriteC // scaled sprite (texture + colorkey) }; -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED +bool PsxFovEnabled; + // view distance double ViewDistanceFactor = 1.0; @@ -80,7 +78,7 @@ int CalculateFogShade(int depth) { return (depth - fogBegin) * 0x1FFF / (fogEnd - fogBegin); } -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED void phd_GenerateW2V(PHD_3DPOS *viewPos) { int sx = phd_sin(viewPos->rotX); @@ -572,23 +570,23 @@ __int16 *__cdecl calc_roomvert(__int16 *ptrObj, BYTE farClip) { persp = FltPersp / zv; depth = zv_int >> W2V_SHIFT; -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED if( depth >= PhdViewDistance ) { -#else // !FEATURE_FOG_DISTANCE +#else // !FEATURE_VIEW_IMPROVED if( depth >= DEPTHQ_END ) { // fog end -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED PhdVBuf[i].g = 0x1FFF; PhdVBuf[i].rhw = 0.0; PhdVBuf[i].clip = farClip; PhdVBuf[i].zv = FltFarZ; } else { -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED PhdVBuf[i].g += CalculateFogShade(depth); -#else // !FEATURE_FOG_DISTANCE +#else // !FEATURE_VIEW_IMPROVED if( depth > DEPTHQ_START ) { // fog begin PhdVBuf[i].g += depth - DEPTHQ_START; } -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED PhdVBuf[i].rhw = persp * FltRhwOPersp; PhdVBuf[i].clip = 0; PhdVBuf[i].zv = zv + baseZ; @@ -694,25 +692,25 @@ void __cdecl phd_PrintPolyList(BYTE *surfacePtr) { void __cdecl AlterFOV(__int16 fov) { fov /= 2; // half fov angle -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_VIEW_IMPROVED int fovWidth = PhdWinHeight*320/(PsxFovEnabled ? 200 : 240); FltViewAspect = 1.0; // must always be 1.0 for unstretched view PhdPersp = (fovWidth / 2) * phd_cos(fov) / phd_sin(fov); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_VIEW_IMPROVED PhdPersp = (PhdWinWidth / 2) * phd_cos(fov) / phd_sin(fov); -#endif // FEATURE_FOV_FIX +#endif // FEATURE_VIEW_IMPROVED FltPersp = (float)PhdPersp; FltRhwOPersp = RhwFactor / FltPersp; FltPerspONearZ = FltPersp / FltNearZ; -#ifndef FEATURE_FOV_FIX // if feature is not defined!!! +#ifndef FEATURE_VIEW_IMPROVED // if feature is not defined!!! double windowAspect = 4.0 / 3.0; if( !SavedAppSettings.FullScreen && SavedAppSettings.AspectMode == AM_16_9 ) { windowAspect = 16.0 / 9.0; } FltViewAspect = windowAspect / ((double)PhdWinWidth / (double)PhdWinHeight); -#endif // !FEATURE_FOV_FIX +#endif // !FEATURE_VIEW_IMPROVED } void __cdecl phd_SetNearZ(int nearZ) { @@ -767,14 +765,14 @@ void __cdecl phd_InitWindow(__int16 x, __int16 y, int width, int height, int nea PhdScreenWidth = screenWidth; PhdScreenHeight = screenHeight; -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED double baseDistance = (double)farZ; farZ = (int)(baseDistance * ViewDistanceFactor); FogBeginDepth = (int)(baseDistance * FogBeginFactor); FogEndDepth = (int)(baseDistance * FogEndFactor); WaterFogBeginDepth = (int)(baseDistance * WaterFogBeginFactor); WaterFogEndDepth = (int)(baseDistance * WaterFogEndFactor); -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED PhdNearZ = nearZ << W2V_SHIFT; PhdFarZ = farZ << W2V_SHIFT; diff --git a/3dsystem/scalespr.cpp b/3dsystem/scalespr.cpp index b2838aa..0052d6b 100644 --- a/3dsystem/scalespr.cpp +++ b/3dsystem/scalespr.cpp @@ -24,9 +24,9 @@ #include "specific/output.h" #include "global/vars.h" -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED extern int CalculateFogShade(int depth); -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED void __cdecl S_DrawSprite(DWORD flags, int x, int y, int z, __int16 spriteIdx, __int16 shade, __int16 scale) { int xv, yv, zv, zp, depth; @@ -102,20 +102,20 @@ void __cdecl S_DrawSprite(DWORD flags, int x, int y, int z, __int16 spriteIdx, _ if( CHK_ANY(flags, SPR_SHADE) ) { // shading required depth = zv >> W2V_SHIFT; -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED if( depth > PhdViewDistance ) return; shade += CalculateFogShade(depth); CLAMP(shade, 0, 0x1FFF); -#else // !FEATURE_FOG_DISTANCE +#else // !FEATURE_VIEW_IMPROVED if( depth > DEPTHQ_START ) { shade += depth - DEPTHQ_START; if( shade > 0x1FFF ) { return; } } -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED } else { shade = 0x1000; } @@ -126,9 +126,9 @@ void __cdecl S_DrawSprite(DWORD flags, int x, int y, int z, __int16 spriteIdx, _ void __cdecl S_DrawPickup(int sx, int sy, int scale, __int16 spriteIdx, __int16 shade) { int x1, x2, y1, y2; -#ifdef FEATURE_SPRITE_SCALE_FIX +#ifdef FEATURE_HUD_IMPROVED scale = GetRenderScale(scale); -#endif +#endif // FEATURE_HUD_IMPROVED x1 = sx + (PhdSpriteInfo[spriteIdx].x1 * scale / PHD_ONE); x2 = sx + (PhdSpriteInfo[spriteIdx].x2 * scale / PHD_ONE); diff --git a/game/health.cpp b/game/health.cpp index 5faaf4f..e278fc2 100644 --- a/game/health.cpp +++ b/game/health.cpp @@ -33,9 +33,9 @@ #define AMMO_XPOS_PS (-16) #define AMMO_YPOS_PS (64) -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED extern bool PsxBarPosEnabled; -#endif // FEATURE_HEALTHBAR_IMPROVED +#endif // FEATURE_HUD_IMPROVED BOOL __cdecl FlashIt() { static int counter = 0; @@ -65,7 +65,7 @@ void __cdecl DrawAssaultTimer() { minutes = SaveGame.statistics.timer / 30 / 60; sprintf(timeString, "%d:%02d.%d", minutes, seconds, deciseconds); -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED scaleH = GetRenderScale(PHD_ONE); scaleV = GetRenderScale(PHD_ONE); xPos = PhdWinMaxX / 2 - GetRenderScale(50); @@ -73,7 +73,7 @@ void __cdecl DrawAssaultTimer() { d0 = GetRenderScale(20); d1 = GetRenderScale(-6); d2 = GetRenderScale(14); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED scaleH = PHD_ONE; scaleV = PHD_ONE; xPos = PhdWinMaxX / 2 - 50; @@ -81,7 +81,7 @@ void __cdecl DrawAssaultTimer() { d0 = 20; d1 = -6; d2 = 14; -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED for( char *str = timeString; *str != 0; ++str ) { switch( *str ) { @@ -143,19 +143,19 @@ void __cdecl DrawHealthBar(BOOL flashState) { if( flashState == 0 ) { S_DrawHealthBar(0); } else { -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED S_DrawHealthBar(PHD_ONE * hitPoints / 1000); -#else // !FEATURE_HEALTHBAR_IMPROVED +#else // !FEATURE_HUD_IMPROVED S_DrawHealthBar(hitPoints / 10); -#endif // FEATURE_HEALTHBAR_IMPROVED +#endif // FEATURE_HUD_IMPROVED } } else if( HealthBarTimer > 0 || hitPoints <= 0 || Lara_GunStatus == LGS_Ready ) { -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED S_DrawHealthBar(PHD_ONE * hitPoints / 1000); -#else // !FEATURE_HEALTHBAR_IMPROVED +#else // !FEATURE_HUD_IMPROVED S_DrawHealthBar(hitPoints / 10); -#endif // FEATURE_HEALTHBAR_IMPROVED +#endif // FEATURE_HUD_IMPROVED } } @@ -171,11 +171,11 @@ void __cdecl DrawAirBar(BOOL flashState) { if( air <= 450 && flashState == 0 ) { S_DrawAirBar(0); } else { -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED S_DrawAirBar(PHD_ONE * air / 1800); -#else // !FEATURE_HEALTHBAR_IMPROVED +#else // !FEATURE_HUD_IMPROVED S_DrawAirBar(100 * air / 1800); -#endif // FEATURE_HEALTHBAR_IMPROVED +#endif // FEATURE_HUD_IMPROVED } } @@ -235,15 +235,15 @@ void __cdecl DrawAmmoInfo() { MakeAmmoString(ammoString); if( AmmoTextInfo == NULL ) { -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED if( PsxBarPosEnabled ) { AmmoTextInfo = T_Print(AMMO_XPOS_PS, AMMO_YPOS_PS, 0, ammoString); } else { AmmoTextInfo = T_Print(AMMO_XPOS_PC, AMMO_YPOS_PC, 0, ammoString); } -#else // !FEATURE_HEALTHBAR_IMPROVED +#else // !FEATURE_HUD_IMPROVED AmmoTextInfo = T_Print(AMMO_XPOS_PC, AMMO_YPOS_PC, 0, ammoString); -#endif // FEATURE_HEALTHBAR_IMPROVED +#endif // FEATURE_HUD_IMPROVED T_RightAlign(AmmoTextInfo, 1); } else { T_ChangeText(AmmoTextInfo, ammoString); @@ -262,11 +262,11 @@ void __cdecl DrawPickups(BOOL pickupState) { if( time <= 0 || time >= 60 ) // 0..2 seconds return; -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED cellH = MIN(PhdWinWidth, PhdWinHeight*320/200) / 10; -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED cellH = PhdWinWidth / 10; -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED cellV = cellH * 2 / 3; x = PhdWinWidth - cellH; diff --git a/game/invtext.cpp b/game/invtext.cpp index 61e2b59..a587a71 100644 --- a/game/invtext.cpp +++ b/game/invtext.cpp @@ -101,13 +101,13 @@ void __cdecl Init_Requester(REQUEST_INFO *req) { req->lpItemFlags1 = RequesterItemFlags1; req->lpItemFlags2 = RequesterItemFlags2; -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED req->renderWidth = GetRenderWidthDownscaled(); req->renderHeight = GetRenderHeightDownscaled(); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED req->renderWidth = GetRenderWidth(); req->renderHeight = GetRenderHeight(); -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED } void __cdecl Remove_Requester(REQUEST_INFO *req) { @@ -171,13 +171,13 @@ int __cdecl Display_Requester(REQUEST_INFO *req, BOOL removeOnDeselect, BOOL isB linesHeight = req->lineHeight * linesCount + 10; linesOff = req->yPos - linesHeight; -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED renderWidth = GetRenderWidthDownscaled(); renderHeight = GetRenderHeightDownscaled(); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED renderWidth = GetRenderWidth(); renderHeight = GetRenderHeight(); -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED if( renderWidth != req->renderWidth || renderHeight != req->renderHeight ) { Remove_Requester(req); @@ -485,11 +485,11 @@ void __cdecl AddRequesterItem(REQUEST_INFO *req, const char *string1, DWORD flag void __cdecl SetPCRequesterSize(REQUEST_INFO *req, int maxLines, __int16 yPos) { req->yPos = yPos; -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED req->visibleCount = GetRenderHeightDownscaled() / 2 / REQ_LN_HEIGHT; -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED req->visibleCount = GetRenderHeight() / 2 / REQ_LN_HEIGHT; -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED if( req->visibleCount > maxLines ) req->visibleCount = maxLines; } diff --git a/game/text.cpp b/game/text.cpp index 1422d1c..66aed33 100644 --- a/game/text.cpp +++ b/game/text.cpp @@ -251,15 +251,15 @@ void __cdecl T_DrawTextBox(int sx, int sy, int z, int width, int height) { int scaleH, scaleV; int meshIdx = Objects[ID_TEXT_BOX].meshIndex; -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED offset = GetRenderScale(4); scaleH = GetRenderScale(PHD_ONE); scaleV = GetRenderScale(PHD_ONE); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED offset = 4; scaleH = PHD_ONE; scaleV = PHD_ONE; -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED x0 = sx + offset; y0 = sy + offset; @@ -493,9 +493,9 @@ void __cdecl T_DrawThisText(TEXT_STR_INFO *textInfo) { } DWORD __cdecl GetTextScaleH(DWORD baseScale) { -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED return GetRenderScale(baseScale); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED DWORD renderWidth, renderScale; renderWidth = GetRenderWidth(); @@ -503,13 +503,13 @@ DWORD __cdecl GetTextScaleH(DWORD baseScale) { renderScale = renderWidth * PHD_ONE / 640; return (baseScale / PHD_HALF) * (renderScale / PHD_HALF); -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED } DWORD __cdecl GetTextScaleV(DWORD baseScale) { -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED return GetRenderScale(baseScale); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED DWORD renderHeight, renderScale; renderHeight = GetRenderHeight(); @@ -517,7 +517,7 @@ DWORD __cdecl GetTextScaleV(DWORD baseScale) { renderScale = renderHeight * PHD_ONE / 480; return (baseScale / PHD_HALF) * (renderScale / PHD_HALF); -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED } /* diff --git a/global/features.h b/global/features.h index 13526a9..5036008 100644 --- a/global/features.h +++ b/global/features.h @@ -24,17 +24,14 @@ #define FEATURE_ASSAULT_SAVE #define FEATURE_BACKGROUND_IMPROVED -#define FEATURE_FOG_DISTANCE -#define FEATURE_FOV_FIX -#define FEATURE_HEALTHBAR_IMPROVED +#define FEATURE_HUD_IMPROVED #define FEATURE_JUMP_COLLISION_FIX #define FEATURE_NOCD_DATA #define FEATURE_PAULD_CDAUDIO #define FEATURE_SCREENSHOT_IMPROVED -#define FEATURE_SCREENSHOT_KEY #define FEATURE_SHADOW_IMPROVED -#define FEATURE_SPRITE_SCALE_FIX #define FEATURE_VIDMODESORT +#define FEATURE_VIEW_IMPROVED #define FEATURE_WINDOW_STYLE_FIX #endif // FEATURES_H_INCLUDED diff --git a/modding/psx_bar.cpp b/modding/psx_bar.cpp index d90879e..cd4784f 100644 --- a/modding/psx_bar.cpp +++ b/modding/psx_bar.cpp @@ -24,7 +24,7 @@ #include "specific/hwr.h" #include "global/vars.h" -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED extern DWORD HealthBarMode; static D3DCOLOR InterpolateColor(D3DCOLOR color0, D3DCOLOR color1, DWORD value, DWORD range) { @@ -144,4 +144,4 @@ void __cdecl PSX_DrawAirBar(int x0, int y0, int x1, int y1, int bar, int pixel) PSX_DrawBar(x0, y0, x1, y1, bar, pixel, left, right, frame); } -#endif // FEATURE_HEALTHBAR_IMPROVED +#endif // FEATURE_HUD_IMPROVED diff --git a/specific/frontend.cpp b/specific/frontend.cpp index 007b9f6..ab02cf8 100644 --- a/specific/frontend.cpp +++ b/specific/frontend.cpp @@ -67,13 +67,13 @@ void __cdecl S_DrawScreenBox(int sx, int sy, int z, int width, int height, BYTE void __cdecl S_DrawScreenFBox(int sx, int sy, int z, int width, int height, BYTE colorIdx, GOURAUD_FILL *gour, UINT16 flags) { int adder; -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED adder = GetRenderScale(2); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED // NOTE: in the original code the adder was 1, but 1 is insufficient, // because there was visible gap between FBox and bottom/right Frame adder = 2; -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED ins_trans_quad(sx, sy, width + adder, height + adder, PhdNearZ + z * 8); } diff --git a/specific/input.cpp b/specific/input.cpp index 7eb2706..b2cd47a 100644 --- a/specific/input.cpp +++ b/specific/input.cpp @@ -217,11 +217,11 @@ bool __cdecl S_UpdateInput() { } // Screenshot -#if defined FEATURE_SCREENSHOT_KEY +#ifdef FEATURE_SCREENSHOT_IMPROVED if( KEY_DOWN(DIK_BACK) ) { // BackSpace Key instead of S -#else // !FEATURE_SCREENSHOT_KEY +#else // !FEATURE_SCREENSHOT_IMPROVED if( KEY_DOWN(DIK_S) ) { -#endif // FEATURE_SCREENSHOT_KEY +#endif // FEATURE_SCREENSHOT_IMPROVED if( !isScreenShotKeyPressed ) { isScreenShotKeyPressed = true; ScreenShot(PrimaryBufferSurface); diff --git a/specific/option.cpp b/specific/option.cpp index 0bcc27e..ef577d4 100644 --- a/specific/option.cpp +++ b/specific/option.cpp @@ -837,14 +837,14 @@ void __cdecl S_ShowControls() { int i, x0, x1, xCenter; bool isCompact; -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED xCenter = GetRenderWidthDownscaled() / 2; isCompact = (xCenter < 240); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED xCenter = GetRenderWidth() / 2; CLAMPG(xCenter, 320); isCompact = (xCenter < 320); -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED if( CtrlTextB[0] == NULL ) { diff --git a/specific/output.cpp b/specific/output.cpp index 03c7f94..3725cc2 100644 --- a/specific/output.cpp +++ b/specific/output.cpp @@ -35,21 +35,18 @@ #include "specific/winvid.h" #include "global/vars.h" -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED #include "modding/psx_bar.h" DWORD HealthBarMode; bool PsxBarPosEnabled; -#endif // FEATURE_HEALTHBAR_IMPROVED - -#ifdef FEATURE_FOV_FIX double GameGUI_Scale = 1.0; double InvGUI_Scale = 1.0; -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED extern int CalculateFogShade(int depth); -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED #ifdef FEATURE_SHADOW_IMPROVED DWORD ShadowMode = 0; @@ -77,13 +74,13 @@ typedef struct ShadowInfo_t { } SHADOW_INFO; int __cdecl GetRenderScale(int unit) { -#ifdef FEATURE_FOV_FIX +#ifdef FEATURE_HUD_IMPROVED int baseWidth = 640 / (IsVidSizeLock ? InvGUI_Scale : GameGUI_Scale); int baseHeight = 480 / (IsVidSizeLock ? InvGUI_Scale : GameGUI_Scale); -#else // !FEATURE_FOV_FIX +#else // !FEATURE_HUD_IMPROVED int baseWidth = 640; int baseHeight = 480; -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED int scaleX = (PhdWinWidth > baseWidth) ? MulDiv(PhdWinWidth, unit, baseWidth) : unit; int scaleY = (PhdWinHeight > baseHeight) ? MulDiv(PhdWinHeight, unit, baseHeight) : unit; return MIN(scaleX, scaleY); @@ -465,12 +462,12 @@ void __cdecl S_CalculateLight(int x, int y, int z, __int16 roomNumber) { // Fog calculation depth = PhdMatrixPtr->_23 >> W2V_SHIFT; -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED LsAdder += CalculateFogShade(depth); -#else // !FEATURE_FOG_DISTANCE +#else // !FEATURE_VIEW_IMPROVED if( depth > DEPTHQ_START ) // fog begin LsAdder += depth - DEPTHQ_START; -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED if( LsAdder > 0x1FFF ) // fog end LsAdder = 0x1FFF; } @@ -480,12 +477,12 @@ void __cdecl S_CalculateStaticLight(__int16 adder) { LsAdder = adder - 0x1000; depth = PhdMatrixPtr->_23 >> W2V_SHIFT; -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED LsAdder += CalculateFogShade(depth); -#else // !FEATURE_FOG_DISTANCE +#else // !FEATURE_VIEW_IMPROVED if( depth > DEPTHQ_START ) // fog begin LsAdder += depth - DEPTHQ_START; -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED if( LsAdder > 0x1FFF ) // fog end LsAdder = 0x1FFF; } @@ -595,7 +592,7 @@ void __cdecl S_LightRoom(ROOM_INFO *room) { } void __cdecl S_DrawHealthBar(int percent) { -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED int barWidth = GetRenderScale(100); int barHeight = GetRenderScale(5); int barXOffset = GetRenderScale((PsxBarPosEnabled && !IsInventoryActive ) ? 20 : 8); @@ -634,7 +631,7 @@ void __cdecl S_DrawHealthBar(int percent) { ins_flat_rect(x0, y0+pixel*0, x0+bar, y0+barHeight, PhdNearZ + 20, InvColours[ICLR_Red]); ins_flat_rect(x0, y0+pixel*1, x0+bar, y0+pixel*2, PhdNearZ + 10, InvColours[ICLR_Orange]); } -#else // !FEATURE_HEALTHBAR_IMPROVED +#else // !FEATURE_HUD_IMPROVED int i; int barWidth = 100; @@ -667,11 +664,11 @@ void __cdecl S_DrawHealthBar(int percent) { for( i = 0; i < barHeight; ++i ) ins_line(x0, y0+i, x0+bar, y0+i, PhdNearZ + 20, ( i == 1 ) ? InvColours[ICLR_Orange] : InvColours[ICLR_Red]); } -#endif // FEATURE_HEALTHBAR_IMPROVED +#endif // FEATURE_HUD_IMPROVED } void __cdecl S_DrawAirBar(int percent) { -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED int barWidth = GetRenderScale(100); int barHeight = GetRenderScale(5); int barXOffset = GetRenderScale(PsxBarPosEnabled ? 20 : 8); @@ -703,7 +700,7 @@ void __cdecl S_DrawAirBar(int percent) { ins_flat_rect(x0, y0+pixel*0, x0+bar, y0+barHeight, PhdNearZ + 20, InvColours[ICLR_Blue]); ins_flat_rect(x0, y0+pixel*1, x0+bar, y0+pixel*2, PhdNearZ + 10, InvColours[ICLR_White]); } -#else // !FEATURE_HEALTHBAR_IMPROVED +#else // !FEATURE_HUD_IMPROVED int i; int barWidth = 100; @@ -736,7 +733,7 @@ void __cdecl S_DrawAirBar(int percent) { for( i = 0; i < barHeight; ++i ) ins_line(x0, y0+i, x0+bar, y0+i, PhdNearZ + 20, ( i == 1 ) ? InvColours[ICLR_White] : InvColours[ICLR_Blue]); } -#endif // FEATURE_HEALTHBAR_IMPROVED +#endif // FEATURE_HUD_IMPROVED } void __cdecl AnimateTextures(int nFrames) { diff --git a/specific/smain.cpp b/specific/smain.cpp index 63db45c..5542932 100644 --- a/specific/smain.cpp +++ b/specific/smain.cpp @@ -46,16 +46,12 @@ #include "modding/background_new.h" #include "global/vars.h" -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED extern DWORD HealthBarMode; extern bool PsxBarPosEnabled; -#endif // FEATURE_HEALTHBAR_IMPROVED - -#ifdef FEATURE_FOV_FIX -extern bool PsxFovEnabled; extern double GameGUI_Scale; extern double InvGUI_Scale; -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED #ifdef FEATURE_BACKGROUND_IMPROVED extern DWORD InvBackgroundMode; @@ -71,13 +67,14 @@ extern DWORD ScreenshotFormat; extern char ScreenshotPath[MAX_PATH]; #endif // FEATURE_SCREENSHOT_IMPROVED -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED +extern bool PsxFovEnabled; extern double ViewDistanceFactor; extern double FogBeginFactor; extern double FogEndFactor; extern double WaterFogBeginFactor; extern double WaterFogEndFactor; -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED #ifdef FEATURE_ASSAULT_SAVE void SaveAssault() { @@ -419,7 +416,7 @@ void __cdecl S_SaveSettings() { SetRegistryBinaryValue(REG_GAME_LAYOUT, (LPBYTE)Layout[CTRL_Custom].key, sizeof(UINT16)*14); CloseGameRegistryKey(); -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED OpenGameRegistryKey(REG_VIEW_KEY); SetRegistryFloatValue(REG_DRAW_DISTANCE, ViewDistanceFactor); SetRegistryFloatValue(REG_FOG_BEGIN, FogBeginFactor); @@ -427,7 +424,7 @@ void __cdecl S_SaveSettings() { SetRegistryFloatValue(REG_UW_FOG_BEGIN, WaterFogBeginFactor); SetRegistryFloatValue(REG_UW_FOG_END, WaterFogEndFactor); CloseGameRegistryKey(); -#endif // FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED } void __cdecl S_LoadSettings() { @@ -441,18 +438,14 @@ void __cdecl S_LoadSettings() { GetRegistryFloatValue(REG_GAME_SIZER, &GameSizer, 1.0); GetRegistryBinaryValue(REG_GAME_LAYOUT, (LPBYTE)Layout[CTRL_Custom].key, sizeof(UINT16)*14, NULL); -#ifdef FEATURE_HEALTHBAR_IMPROVED +#ifdef FEATURE_HUD_IMPROVED GetRegistryDwordValue(REG_HEALTHBAR_MODE, &HealthBarMode, 0); GetRegistryBoolValue(REG_PSXBARPOS_ENABLE, &PsxBarPosEnabled, false); -#endif // FEATURE_HEALTHBAR_IMPROVED - -#ifdef FEATURE_FOV_FIX - GetRegistryBoolValue(REG_PSXFOV_ENABLE, &PsxFovEnabled, false); GetRegistryFloatValue(REG_GAME_GUI_SCALE, &GameGUI_Scale, 1.0); GetRegistryFloatValue(REG_INV_GUI_SCALE, &InvGUI_Scale, 1.0); CLAMP(GameGUI_Scale, 1.0, 2.0); CLAMP(InvGUI_Scale, 1.0, 2.0); -#endif // FEATURE_FOV_FIX +#endif // FEATURE_HUD_IMPROVED #ifdef FEATURE_BACKGROUND_IMPROVED GetRegistryDwordValue(REG_INVBGND_MODE, &InvBackgroundMode, 1); @@ -483,7 +476,9 @@ void __cdecl S_LoadSettings() { S_SoundSetMasterVolume(6 * SoundVolume + 4); // 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64 S_CDVolume(MusicVolume ? MusicVolume*25+5 : 0); // 0, 30, 55, 80, 105, 130, 155, 180, 205, 230, 255 -#ifdef FEATURE_FOG_DISTANCE +#ifdef FEATURE_VIEW_IMPROVED + GetRegistryBoolValue(REG_PSXFOV_ENABLE, &PsxFovEnabled, false); + OpenGameRegistryKey(REG_VIEW_KEY); GetRegistryFloatValue(REG_DRAW_DISTANCE, &ViewDistanceFactor, 1.0); GetRegistryFloatValue(REG_FOG_BEGIN, &FogBeginFactor, 0.6); @@ -497,11 +492,9 @@ void __cdecl S_LoadSettings() { CLAMP(FogBeginFactor, 0.0, FogEndFactor); CLAMP(WaterFogEndFactor, 0.0, FogEndFactor); CLAMP(WaterFogBeginFactor, 0.0, FogBeginFactor); -#endif // FEATURE_FOG_DISTANCE -#if defined (FEATURE_FOV_FIX) || defined (FEATURE_FOG_DISTANCE) setup_screen_size(); -#endif // FEATURE_FOV_FIX || FEATURE_FOG_DISTANCE +#endif // FEATURE_VIEW_IMPROVED } /*