[rott-commits] r276 - trunk/rott
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Jun 27 01:27:42 EDT 2013
Author: fabian
Date: 2013-06-27 01:27:42 -0400 (Thu, 27 Jun 2013)
New Revision: 276
Modified:
trunk/rott/modexlib.c
Log:
Color crosshair by health
Modified: trunk/rott/modexlib.c
===================================================================
--- trunk/rott/modexlib.c 2013-02-20 19:44:37 UTC (rev 275)
+++ trunk/rott/modexlib.c 2013-06-27 05:27:42 UTC (rev 276)
@@ -39,6 +39,7 @@
#include "memcheck.h"
#include "rt_util.h"
#include "rt_net.h" // for GamePaused
+#include "myprint.h"
static void StretchMemPicture ();
// GLOBAL VARIABLES
@@ -796,6 +797,10 @@
void DrawCenterAim ()
{
int x;
+
+ int percenthealth = (locplayerstate->health * 10) / MaxHitpointsForCharacter(locplayerstate);
+ int color = percenthealth < 3 ? egacolor[RED] : percenthealth < 4 ? egacolor[YELLOW] : egacolor[GREEN];
+
if (iG_aimCross && !GamePaused){
if (( ingame == true )&&(iGLOBAL_SCREENWIDTH>320)){
if ((iG_playerTilt <0 )||(iG_playerTilt >iGLOBAL_SCREENHEIGHT/2)){
@@ -806,22 +811,22 @@
for (x=iG_X_center-10;x<=iG_X_center-4;x++){
if ((iG_buf_center+x < bufofsTopLimit)&&(iG_buf_center+x > bufofsBottomLimit)){
- *(iG_buf_center+x) = 75;
+ *(iG_buf_center+x) = color;
}
}
for (x=iG_X_center+4;x<=iG_X_center+10;x++){
if ((iG_buf_center+x < bufofsTopLimit)&&(iG_buf_center+x > bufofsBottomLimit)){
- *(iG_buf_center+x) = 75;
+ *(iG_buf_center+x) = color;
}
}
for (x=10;x>=4;x--){
if (((iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) < bufofsTopLimit)&&((iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) > bufofsBottomLimit)){
- *(iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) = 75;
+ *(iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) = color;
}
}
for (x=4;x<=10;x++){
if (((iG_buf_center+(x*iGLOBAL_SCREENWIDTH)+iG_X_center) < bufofsTopLimit)&&((iG_buf_center+(x*iGLOBAL_SCREENWIDTH)+iG_X_center) > bufofsBottomLimit)){
- *(iG_buf_center+(x*iGLOBAL_SCREENWIDTH)+iG_X_center) = 75;
+ *(iG_buf_center+(x*iGLOBAL_SCREENWIDTH)+iG_X_center) = color;
}
}
}
More information about the rott-commits
mailing list