Skip to content

Commit

Permalink
- additional surfaceflags for different surface types such as snow, w…
Browse files Browse the repository at this point in the history
…ood, sand, gravel, foilage, ice, and glass

- improve hexcolors in the ui, allow for on-demand refresh of ui colors, add more hexcolors
- increase some limits of elements in the ui
- suppress excess ui warnings into developer
- sergei/kyonshi do not exist in OA3; default to sarge for missionpack currently (avoids crashes)
- don't attempt to load from characters/
- changing one model also changes teammodel
- add preliminary support for entity glow functionality and alternate shells for them (requires renderer engine changes to support). the primary idea behind alternate shell is performance and to avoid overdraw by force altering the model's vertex colors instead (overriding lighting and any other rgbGen op)
- add preliminary support for drawing player names above teammate heads (requires client engine changes to support)
- cg_hitSound camel-cased and defaults to 1 (again)
- reducing clown cruft by dropping the reference from the teamnames and just going for red/blue for now
- removed cg_leiChibi (again)
  • Loading branch information
leilei- committed Apr 13, 2024
1 parent 2419368 commit 6d57ef0
Show file tree
Hide file tree
Showing 19 changed files with 558 additions and 154 deletions.
102 changes: 101 additions & 1 deletion code/cgame/cg_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ void CG_Text_PaintChar(float x, float y, float width, float height, float scale,
trap_R_DrawStretchPic(x, y, w, h, s, t, s2, t2, hShader);
}


void CG_Text_PaintCharNoAdjust(float x, float y, float width, float height, float scale, float s, float t, float s2, float t2, qhandle_t hShader) {
float w, h;
w = width * scale;
h = height * scale;
trap_R_DrawStretchPic(x, y, w, h, s, t, s2, t2, hShader);
}

void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style) {
int len, count;
vec4_t newColor;
Expand Down Expand Up @@ -191,6 +199,75 @@ void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text
}



void CG_Text_Paint_3D(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style) {
int len, count;
vec4_t newColor;
glyphInfo_t *glyph;
float useScale;
fontInfo_t *font = &cgDC.Assets.textFont;
if (scale <= cg_smallFont.value) {
font = &cgDC.Assets.smallFont;
} else if (scale > cg_bigFont.value) {
font = &cgDC.Assets.bigFont;
}
useScale = scale * font->glyphScale;
if (text) {
const char *s = text;
trap_R_SetColor(color);
memcpy(&newColor[0], &color[0], sizeof (vec4_t));
len = strlen(text);
if (limit > 0 && len > limit) {
len = limit;
}
count = 0;
while (s && *s && count < len) {
glyph = &font->glyphs[*s & 255];
if (Q_IsColorString(s)) {
memcpy(newColor, g_color_table[ColorIndex(*(s + 1))], sizeof ( newColor));
newColor[3] = color[3];
trap_R_SetColor(newColor);
s += 2;
continue;
} else {
float yadj = useScale * glyph->top;
if (style == ITEM_TEXTSTYLE_SHADOWED || style == ITEM_TEXTSTYLE_SHADOWEDMORE) {
int ofs = style == ITEM_TEXTSTYLE_SHADOWED ? 1 : 2;
colorBlack[3] = newColor[3];
trap_R_SetColor(colorBlack);
CG_Text_PaintCharNoAdjust(x + ofs, y - yadj + ofs,
glyph->imageWidth,
glyph->imageHeight,
useScale,
glyph->s,
glyph->t,
glyph->s2,
glyph->t2,
glyph->glyph);
colorBlack[3] = 1.0;
trap_R_SetColor(newColor);
}
CG_Text_PaintCharNoAdjust(x, y - yadj,
glyph->imageWidth,
glyph->imageHeight,
useScale,
glyph->s,
glyph->t,
glyph->s2,
glyph->t2,
glyph->glyph);
// CG_DrawPic(x, y - yadj, scale * cgDC.Assets.textFont.glyphs[text[i]].imageWidth, scale * cgDC.Assets.textFont.glyphs[text[i]].imageHeight, cgDC.Assets.textFont.glyphs[text[i]].glyph);
x += (glyph->xSkip * useScale) + adjust;
s++;
count++;
}
}
trap_R_SetColor(NULL);
}
}



#endif

/*
Expand Down Expand Up @@ -3474,6 +3551,8 @@ void CG_DrawTimedMenus(void) {
CG_Draw2D
=================
*/
void CG_PlayerSpritesOverWorld(centity_t *cent);

static void CG_Draw2D(stereoFrame_t stereoFrame) {
#ifdef MISSIONPACK
if (cgs.orderPending && cg.time > cgs.orderTime) {
Expand Down Expand Up @@ -3546,6 +3625,25 @@ static void CG_Draw2D(stereoFrame_t stereoFrame) {

CG_DrawLagometer();

// leilei - draw the player's names
#ifdef MISSIONPACK
{
int f;
centity_t *cent;
vec3_t angles;
vec3_t origin;



for (f=0;f<MAX_CLIENTS;f++){
cent = &cg.headent[f];
if (cent);
CG_PlayerSpritesOverWorld(cent);
}

}
#endif

#ifdef MISSIONPACK
if (!cg_paused.integer) {
CG_DrawUpperRight(stereoFrame);
Expand All @@ -3571,11 +3669,13 @@ static void CG_Draw2D(stereoFrame_t stereoFrame) {
CG_DrawCenterDDString();
CG_DrawCenter1FctfString();
CG_DrawCenterString();
}

cg.accBoardShowing = CG_DrawAccboard();
}


}

/*
=====================
CG_DrawActive
Expand Down
49 changes: 49 additions & 0 deletions code/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,55 @@ void CG_EntityEvent(centity_t *cent, vec3_t position) {
cgs.media.footsteps[ FOOTSTEP_METAL ][rand()&3]);
}
break;
case EV_FOOTSTEP_SNOW:
DEBUGNAME("EV_FOOTSTEP_SNOW");
if (cg_footsteps.integer) {
trap_S_StartSound(NULL, es->number, CHAN_BODY,
cgs.media.footsteps[ FOOTSTEP_SNOW ][rand()&3]);
}
break;
case EV_FOOTSTEP_WOOD:
DEBUGNAME("EV_FOOTSTEP_WOOD");
if (cg_footsteps.integer) {
trap_S_StartSound(NULL, es->number, CHAN_BODY,
cgs.media.footsteps[ FOOTSTEP_WOOD ][rand()&3]);
}
break;
case EV_FOOTSTEP_SAND:
DEBUGNAME("EV_FOOTSTEP_SAND");
if (cg_footsteps.integer) {
trap_S_StartSound(NULL, es->number, CHAN_BODY,
cgs.media.footsteps[ FOOTSTEP_SAND ][rand()&3]);
}
break;
case EV_FOOTSTEP_GRAVEL:
DEBUGNAME("EV_FOOTSTEP_GRAVEL");
if (cg_footsteps.integer) {
trap_S_StartSound(NULL, es->number, CHAN_BODY,
cgs.media.footsteps[ FOOTSTEP_GRAVEL ][rand()&3]);
}
break;
case EV_FOOTSTEP_FOILAGE:
DEBUGNAME("EV_FOOTSTEP_FOILAGE");
if (cg_footsteps.integer) {
trap_S_StartSound(NULL, es->number, CHAN_BODY,
cgs.media.footsteps[ FOOTSTEP_FOILAGE ][rand()&3]);
}
break;
case EV_FOOTSTEP_ICE:
DEBUGNAME("EV_FOOTSTEP_ICE");
if (cg_footsteps.integer) {
trap_S_StartSound(NULL, es->number, CHAN_BODY,
cgs.media.footsteps[ FOOTSTEP_ICE ][rand()&3]);
}
break;
case EV_FOOTSTEP_GLASS:
DEBUGNAME("EV_FOOTSTEP_GLASS");
if (cg_footsteps.integer) {
trap_S_StartSound(NULL, es->number, CHAN_BODY,
cgs.media.footsteps[ FOOTSTEP_GLASS ][rand()&3]);
}
break;
case EV_FOOTSPLASH:
DEBUGNAME("EV_FOOTSPLASH");
if (cg_footsteps.integer) {
Expand Down
32 changes: 26 additions & 6 deletions code/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// leilei - change these to sorceress for baseoa3 as there is no sarge or sergei
#define DEFAULT_MODEL "sarge"
#ifdef MISSIONPACK
#define DEFAULT_TEAM_MODEL "sergei"
#define DEFAULT_TEAM_HEAD "*sergei"
#define DEFAULT_TEAM_MODEL "sarge"
#define DEFAULT_TEAM_HEAD "sarge"
#else
#define DEFAULT_TEAM_MODEL "sarge"
#define DEFAULT_TEAM_HEAD "sarge"
#endif

#define DEFAULT_REDTEAM_NAME "Vim supporters"
#define DEFAULT_BLUETEAM_NAME "Emacs supporters"
#define DEFAULT_REDTEAM_NAME "Red"
#define DEFAULT_BLUETEAM_NAME "Blue"

typedef enum {
FOOTSTEP_NORMAL,
Expand All @@ -106,14 +106,25 @@ typedef enum {
FOOTSTEP_ENERGY,
FOOTSTEP_METAL,
FOOTSTEP_SPLASH,
FOOTSTEP_SNOW,
FOOTSTEP_WOOD,
FOOTSTEP_GRAVEL,
FOOTSTEP_SAND,
FOOTSTEP_FOILAGE,
FOOTSTEP_ICE,
FOOTSTEP_GLASS,

FOOTSTEP_TOTAL
} footstep_t;

typedef enum {
IMPACTSOUND_DEFAULT,
IMPACTSOUND_METAL,
IMPACTSOUND_FLESH
IMPACTSOUND_FLESH,
IMPACTSOUND_GLASS,
IMPACTSOUND_SAND,
IMPACTSOUND_SNOW,
IMPACTSOUND_WOOD
} impactSound_t;

//=================================================
Expand Down Expand Up @@ -223,6 +234,7 @@ typedef struct centity_s {
int muztime[5];
int muzslot;
float muzroll[5];
vec3_t headpos; // leilei - position of the head model (for bubbles)
} centity_t;


Expand Down Expand Up @@ -746,6 +758,9 @@ typedef struct {
#endif


vec3_t headpos[MAX_CLIENTS]; // head positions of each client
centity_t headent[MAX_CLIENTS]; // head's entity so we know which
int headon[MAX_CLIENTS];
} cg_t;


Expand Down Expand Up @@ -1337,6 +1352,7 @@ extern vmCvar_t cg_tracerLength;
extern vmCvar_t cg_autoswitch;
extern vmCvar_t cg_ignore;
extern vmCvar_t cg_simpleItems;
extern vmCvar_t cg_alternateShell;
extern vmCvar_t cg_fov;
extern vmCvar_t cg_zoomFov;
extern vmCvar_t cg_thirdPersonRange;
Expand Down Expand Up @@ -1475,7 +1491,7 @@ extern vmCvar_t cg_teamChatBeep;
/* Neon_Knight: Toggleable missionpack checks. */
extern vmCvar_t cg_missionpackChecks;
/* /Neon_Knight */
extern vmCvar_t cg_leiChibi;

/* Neon_Knight: Developer mode. */
extern vmCvar_t cg_developer;
/* /Neon_Knight */
Expand Down Expand Up @@ -1581,8 +1597,11 @@ void CG_DrawFlagModel( float x, float y, float w, float h, int team, qboolean fo
void CG_DrawTeamBackground( int x, int y, int w, int h, float alpha, int team );
void CG_OwnerDraw(float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, float special, float scale, vec4_t color, qhandle_t shader, int textStyle);
void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style);
#ifdef MISSIONPACK
void CG_Text_Paint_3D(float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style);
int CG_Text_Width(const char *text, float scale, int limit);
int CG_Text_Height(const char *text, float scale, int limit);
#endif
void CG_SelectPrevPlayer( void );
void CG_SelectNextPlayer( void );
float CG_GetValue(int ownerDraw);
Expand Down Expand Up @@ -1993,6 +2012,7 @@ extern qboolean initparticles;
extern int wideAdjustX;

void trap_R_LFX_ParticleEffect( int effect, const vec3_t origin, const vec3_t velocity ); // leilei - particle effects. this allows to pick an effect, such as..
void trap_R_GetViewPosition( vec3_t point );

#define LFX_SMOKEPUFF 1;
#define LFX_BULLETHIT 2;
Expand Down
Loading

0 comments on commit 6d57ef0

Please sign in to comment.