Skip to content

Commit

Permalink
HealthBar mode added: PSX without extra frame
Browse files Browse the repository at this point in the history
  • Loading branch information
Arsunt committed Feb 17, 2018
1 parent ae40d11 commit b663edc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions modding/psx_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "global/vars.h"

#ifdef FEATURE_HEALTHBAR_IMPROVED
extern DWORD HealthBarMode;

static D3DCOLOR InterpolateColor(D3DCOLOR color0, D3DCOLOR color1, DWORD value, DWORD range) {
if( value == 0 )
Expand Down Expand Up @@ -86,9 +87,12 @@ static void __cdecl DrawCololoredRect(float sx0, float sy0, float sx1, float sy1
}

static void PSX_DrawBar(int x0, int y0, int x1, int y1, int bar, int pixel, D3DCOLOR *left, D3DCOLOR *right, D3DCOLOR *frame) {
// The frame
DrawCololoredRect(x0-pixel*3, y0-pixel*1, x1+pixel*3, y1+pixel*1, PhdNearZ + 40, frame[4], frame[5], frame[5], frame[4]);
// Extra frame (dark gray)
if( HealthBarMode == 2 ) // draw extra frame only if full PSX style enabled
DrawCololoredRect(x0-pixel*3, y0-pixel*1, x1+pixel*3, y1+pixel*1, PhdNearZ + 40, frame[4], frame[5], frame[5], frame[4]);
// Outer frame (light gray)
DrawCololoredRect(x0-pixel*2, y0-pixel*2, x1+pixel*2, y1+pixel*2, PhdNearZ + 30, frame[2], frame[3], frame[3], frame[2]);
// Inner frame (black)
DrawCololoredRect(x0-pixel*1, y0-pixel*1, x1+pixel*1, y1+pixel*1, PhdNearZ + 20, frame[0], frame[1], frame[1], frame[0]);

// The bar
Expand Down
6 changes: 3 additions & 3 deletions specific/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#ifdef FEATURE_HEALTHBAR_IMPROVED
#include "modding/psx_bar.h"

bool PsxBarsEnabled;
DWORD HealthBarMode;
bool PsxBarPosEnabled;
#endif // FEATURE_HEALTHBAR_IMPROVED

Expand Down Expand Up @@ -570,7 +570,7 @@ void __cdecl S_DrawHealthBar(int percent) {
// Disable underwater shading
IsShadeEffect = false;

if( PsxBarsEnabled && SavedAppSettings.RenderMode == RM_Hardware && SavedAppSettings.ZBuffer ) {
if( HealthBarMode != 0 && SavedAppSettings.RenderMode == RM_Hardware && SavedAppSettings.ZBuffer ) {
PSX_DrawHealthBar(x0, y0, x1, y1, bar, pixel);
return;
}
Expand Down Expand Up @@ -639,7 +639,7 @@ void __cdecl S_DrawAirBar(int percent) {
// Disable underwater shading
IsShadeEffect = false;

if( PsxBarsEnabled && SavedAppSettings.RenderMode == RM_Hardware && SavedAppSettings.ZBuffer ) {
if( HealthBarMode != 0 && SavedAppSettings.RenderMode == RM_Hardware && SavedAppSettings.ZBuffer ) {
PSX_DrawAirBar(x0, y0, x1, y1, bar, pixel);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion specific/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#define REG_SOUND_VOLUME "SoundFXVolume"
#define REG_DETAIL_LEVEL "DetailLevel"
#define REG_INVBGND_MODE "InvBackgroundMode"
#define REG_HEALTHBAR_MODE "HealthBarMode"

// BOOL value names
#define REG_PERSPECTIVE "PerspectiveCorrect"
Expand All @@ -65,7 +66,6 @@
#define REG_SORT_DISABLE "DontSortPrimitives"
#define REG_FLIP_BROKEN "FlipBroken"
#define REG_FMV_DISABLE "DisableFMV"
#define REG_PSXBAR_ENABLE "EnablePsxBars"
#define REG_PSXBARPOS_ENABLE "EnablePsxBarPos"
#define REG_PSXFOV_ENABLE "EnablePsxFov"

Expand Down
4 changes: 2 additions & 2 deletions specific/smain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "global/vars.h"

#ifdef FEATURE_HEALTHBAR_IMPROVED
extern bool PsxBarsEnabled;
extern DWORD HealthBarMode;
extern bool PsxBarPosEnabled;
#endif // FEATURE_HEALTHBAR_IMPROVED

Expand Down Expand Up @@ -408,7 +408,7 @@ void __cdecl S_LoadSettings() {
GetRegistryBinaryValue(REG_GAME_LAYOUT, (LPBYTE)Layout[CTRL_Custom].key, sizeof(UINT16)*14, NULL);

#ifdef FEATURE_HEALTHBAR_IMPROVED
GetRegistryBoolValue(REG_PSXBAR_ENABLE, &PsxBarsEnabled, false);
GetRegistryDwordValue(REG_HEALTHBAR_MODE, &HealthBarMode, 0);
GetRegistryBoolValue(REG_PSXBARPOS_ENABLE, &PsxBarPosEnabled, false);
#endif // FEATURE_HEALTHBAR_IMPROVED

Expand Down

0 comments on commit b663edc

Please sign in to comment.