Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Add simple reticule scalable size
Browse files Browse the repository at this point in the history
  • Loading branch information
gennariarmando committed Jan 8, 2022
1 parent 6dbac38 commit edbe9c5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions resources/VHud/text/english.ini
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ FE_IRA = Invert Right Axis
FE_HUD = HUD
FE_RAD = Radar
FE_TAR = Weapon Target
FE_SRZ = Simple Reticule Size
FE_SIM = Simple
FE_COMP = Complex
FE_SUB = Subtitles
Expand Down
1 change: 1 addition & 0 deletions resources/VHud/text/italian.ini
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ FE_IRA = Inverti asse destro
FE_HUD = HUD
FE_RAD = Radar
FE_TAR = Mirino
FE_SRZ = Dimensione mirino semplice
FE_SIM = Semplice
FE_COMP = Complesso
FE_SUB = Sottotitoli
Expand Down
8 changes: 5 additions & 3 deletions source/HudNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,10 @@ void CHudNew::DrawCrosshairs() {
col.a = dotAlpha;
int crosshairType = CROSSHAIR_DOT;
bool withDot = true;

float simplereticuleSize = (MenuNew.Settings.simpleReticuleSize * 0.8f) + 1.0f;

if (MenuNew.Settings.weaponTarget) {
simplereticuleSize = 1.0f;
radius = clamp(radius, 1.0f, 4.0f);

if (!faststrcmp(crosshairName, "assault")) {
Expand Down Expand Up @@ -666,8 +668,8 @@ void CHudNew::DrawCrosshairs() {
}

if (withDot) {
w = GET_SETTING(HUD_CROSSHAIR_DOT).w;
h = GET_SETTING(HUD_CROSSHAIR_DOT).h;
w = GET_SETTING(HUD_CROSSHAIR_DOT).w * simplereticuleSize;
h = GET_SETTING(HUD_CROSSHAIR_DOT).h * simplereticuleSize;
CrosshairsSprites[CROSSHAIR_DOT]->Draw(CRect(x - SCREEN_COORD(w), y - SCREEN_COORD(h), x + SCREEN_COORD(w), y + SCREEN_COORD(h)), col);
}

Expand Down
13 changes: 13 additions & 0 deletions source/MenuNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ void CMenuNew::BuildMenuScreen() {
AddNewEntry(display, MENUENTRY_SHOWRADAR, "FE_RAD", 0, 0);
AddNewEntry(display, MENUENTRY_SHOWHUD, "FE_HUD", 0, 0);
AddNewEntry(display, MENUENTRY_WEAPONTARGET, "FE_TAR", 0, 0);
AddNewEntry(display, MENUENTRY_SIMPLERETICULESIZE, "FE_SRZ", 0, 0);
AddNewEntry(display, MENUENTRY_GPSROUTE, "FE_GPS", 0, 0);
AddNewEntry(display, MENUENTRY_BRIGHTNESS, "FE_BRI", 0, 0);
AddNewEntry(display, MENUENTRY_GAMMA, "FE_GMA", 0, 0);
Expand Down Expand Up @@ -2122,6 +2123,7 @@ void CMenuNew::ProcessEntryStuff(int enter, int input) {
case MENUENTRY_MOUSESENSITIVITY:
case MENUENTRY_GAMMA:
case MENUENTRY_SAFEZONESIZE:
case MENUENTRY_SIMPLERETICULESIZE:
CheckSliderMovement(input);
ApplyChanges();
break;
Expand Down Expand Up @@ -2210,6 +2212,10 @@ void CMenuNew::CheckSliderMovement(double value) {
TheCamera.m_fMouseAccelHorzntl = (float)ts.mouseSensitivity;
TheCamera.m_fMouseAccelVertical = (float)ts.mouseSensitivity;
break;
case MENUENTRY_SIMPLERETICULESIZE:
ts.simpleReticuleSize += double(value * 1.0);
ts.simpleReticuleSize = clamp(ts.simpleReticuleSize, 0, 1.0);
break;
}
}

Expand Down Expand Up @@ -3137,6 +3143,9 @@ void CMenuNew::DrawDefault() {
case MENUENTRY_MOUSESENSITIVITY:
DrawSliderRightAlign(menuEntry.left + menuEntry.right + SCREEN_COORD(-12.0f), menuEntry.top + SCREEN_COORD(14.0f), TempSettings.mouseSensitivity * 200.0f);
break;
case MENUENTRY_SIMPLERETICULESIZE:
DrawSliderRightAlign(menuEntry.left + menuEntry.right + SCREEN_COORD(-12.0f), menuEntry.top + SCREEN_COORD(14.0f), TempSettings.simpleReticuleSize / 1.0f);
break;
default:
arrows = false;
break;
Expand Down Expand Up @@ -4644,6 +4653,8 @@ void CMenuNew::RestoreDefaults(CMenuSettings* ts, int index) {
ts->language = 0;
ts->showHUD = true;
ts->showRadar = true;
ts->weaponTarget = 0;
ts->simpleReticuleSize = 0.0;
ts->savePhotos = true;
ts->gpsRoute = true;
ts->safeZoneSize = 32.0;
Expand Down Expand Up @@ -4771,6 +4782,7 @@ void CMenuSettings::Load() {
showHUD = display.child("ShowHUD").attribute("value").as_bool();
showRadar = display.child("ShowRadar").attribute("value").as_bool();
weaponTarget = display.child("WeaponTarget").attribute("value").as_int();
simpleReticuleSize = display.child("SimpleReticuleSize").attribute("value").as_double();
savePhotos = display.child("SavePhotos").attribute("value").as_bool();
gpsRoute = display.child("GpsRoute").attribute("value").as_bool();
safeZoneSize = display.child("SafeZoneSize").attribute("value").as_double();
Expand Down Expand Up @@ -4861,6 +4873,7 @@ void CMenuSettings::Save() {
display.append_child("ShowHUD").append_attribute("value").set_value(showHUD);
display.append_child("ShowRadar").append_attribute("value").set_value(showRadar);
display.append_child("WeaponTarget").append_attribute("value").set_value(weaponTarget);
display.append_child("SimpleReticuleSize").append_attribute("value").set_value(simpleReticuleSize);
display.append_child("SavePhotos").append_attribute("value").set_value(savePhotos);
display.append_child("GpsRoute").append_attribute("value").set_value(gpsRoute);
display.append_child("SafeZoneSize").append_attribute("value").set_value(safeZoneSize);
Expand Down
2 changes: 2 additions & 0 deletions source/MenuNew.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ enum eMenuEntries {
MENUENTRY_SHOWHUD,
MENUENTRY_SHOWRADAR,
MENUENTRY_WEAPONTARGET,
MENUENTRY_SIMPLERETICULESIZE,
MENUENTRY_GPSROUTE,
MENUENTRY_SAFEZONESIZE,
MENUENTRY_MEASUREMENTSYS,
Expand Down Expand Up @@ -314,6 +315,7 @@ class CMenuSettings {
bool showHUD;
bool showRadar;
int weaponTarget;
double simpleReticuleSize;
bool savePhotos;
bool gpsRoute;
double safeZoneSize;
Expand Down

0 comments on commit edbe9c5

Please sign in to comment.