-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from Koud-Wind/Configurable-bullet-counter
Configurable bullet counter
- Loading branch information
Showing
3 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,7 +241,7 @@ public void handleModificationHUD(RenderGameOverlayEvent.Pre event, PlayerWeapon | |
// Ammo counter spec | ||
public static final int AMMO_COUNTER_WIDTH = 256; | ||
public static final int AMMO_COUNTER_HEIGHT = 53; | ||
public static final double AMMO_COUNTER_SCALE = 0.50; | ||
//public static final double AMMO_COUNTER_SCALE = 0.50; | ||
|
||
// Weapon name | ||
public static final int AMMO_COUNTER_WEAPON_NAME_DOWNSCALE_THRESHOLD = 13; | ||
|
@@ -277,17 +277,20 @@ public void handleModificationHUD(RenderGameOverlayEvent.Pre event, PlayerWeapon | |
public static final double CURRENT_AMMO_WIDTH_MULTIPLIER = 2.0; | ||
public static final double TOTAL_AMMO_STRING_SCALE = 6.625; | ||
|
||
public void handleAmmoCounter(RenderGameOverlayEvent.Pre event, PlayerWeaponInstance weaponInstance, double scaledWidth, double scaledHeight) { final int AMMO_COUNTER_Y_POS = 128; | ||
|
||
public void handleAmmoCounter(RenderGameOverlayEvent.Pre event, PlayerWeaponInstance weaponInstance, double scaledWidth, double scaledHeight) { | ||
//If moved up, the game needs to be restarted every time there is a change | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Desoroxxx
Collaborator
|
||
final int AMMO_COUNTER_X_POS = 256 + ModernConfigManager.ammoCounterX; | ||
final int AMMO_COUNTER_Y_POS = 128 + ModernConfigManager.ammoCounterY; | ||
final double AMMO_COUNTER_SIZE = ModernConfigManager.ammoCounterSize; | ||
|
||
|
||
GlStateManager.enableBlend(); | ||
GlStateManager.pushMatrix(); | ||
|
||
GlStateManager.translate((scaledWidth - AMMO_COUNTER_WIDTH * AMMO_COUNTER_SCALE), (scaledHeight - AMMO_COUNTER_Y_POS * AMMO_COUNTER_SCALE), 0); | ||
GlStateManager.scale(AMMO_COUNTER_SCALE, AMMO_COUNTER_SCALE, AMMO_COUNTER_SCALE); | ||
GlStateManager.translate((scaledWidth - AMMO_COUNTER_X_POS * AMMO_COUNTER_SIZE), (scaledHeight - AMMO_COUNTER_Y_POS * AMMO_COUNTER_SIZE), 0); | ||
GlStateManager.scale(AMMO_COUNTER_SIZE, AMMO_COUNTER_SIZE, AMMO_COUNTER_SIZE); | ||
mc.getTextureManager().bindTexture(AMMO_COUNTER_TEXTURES); | ||
|
||
|
||
// Figure out the firemode, and assign it an ID | ||
int firemode = 0; | ||
switch(weaponInstance.getMaxShots()) { | ||
|
@@ -327,17 +330,24 @@ public void handleModificationHUD(RenderGameOverlayEvent.Pre event, PlayerWeapon | |
double keyNameOffset = getFontRenderer().getStringWidth(keyNameString); | ||
|
||
// Render main ammo counter body | ||
if(ModernConfigManager.enableAmmoCounterBackground) drawTexturedModalRect(0, 0, 0, 0, AMMO_COUNTER_WIDTH, AMMO_COUNTER_HEIGHT); | ||
|
||
|
||
if(ModernConfigManager.enableAmmoCounterBackground) { | ||
if(ModernConfigManager.ammoCounterBackgroundReverse) { | ||
GlStateManager.enableBlend(); | ||
GlStateManager.pushMatrix(); | ||
GlStateManager.scale(-1, 1, 1); | ||
drawTexturedModalRect(-90, 0, 0, 0, -AMMO_COUNTER_WIDTH, AMMO_COUNTER_HEIGHT); | ||
GlStateManager.popMatrix(); | ||
} else | ||
drawTexturedModalRect(0, 0, 0, 0, AMMO_COUNTER_WIDTH, AMMO_COUNTER_HEIGHT); | ||
} | ||
|
||
// Draw the firemode indicator | ||
|
||
GlStateManager.pushMatrix(); | ||
GlStateManager.translate(AMMO_COUNTER_WIDTH - FIREMODE_INDICATOR_X_OFFSET - (keyNameOffset * KEY_NAME_OFFSET_FIREMODE_INDICATOR_MULTIPLIER), FIREMODE_INDICATOR_Y_OFFSET, 0); | ||
GlStateManager.scale(FIREMODE_INDICATOR_SCALE, FIREMODE_INDICATOR_SCALE, FIREMODE_INDICATOR_SCALE); | ||
GlStateManager.enableBlend(); | ||
drawTexturedModalRect(0, 0, | ||
drawTexturedModalRect(0, 0, | ||
FIREMODE_INDICATOR_U_OFFSET + FIREMODE_INDICATOR_U_WIDTH * (Weapon.FIREMODE_AUTO - firemode), | ||
FIREMODE_INDICATOR_V_HEIGHT, FIREMODE_INDICATOR_U_WIDTH, FIREMODE_INDICATOR_U_WIDTH); | ||
GlStateManager.popMatrix(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why??? why not make it not mutable and allow hot reloading???
This is terrible, imagine moving the UI and not liking it restarting the modpack for 10 minutes oh wait I want it to the right, 10 minutes later oh shit a little bit down