diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c index ba874cb..afbd244 100644 --- a/code/cgame/cg_draw.c +++ b/code/cgame/cg_draw.c @@ -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; @@ -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 /* @@ -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) { @@ -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;fnumber, 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) { diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index ab62f6f..6051cd5 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -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, @@ -106,6 +106,13 @@ 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; @@ -113,7 +120,11 @@ typedef enum { typedef enum { IMPACTSOUND_DEFAULT, IMPACTSOUND_METAL, - IMPACTSOUND_FLESH + IMPACTSOUND_FLESH, + IMPACTSOUND_GLASS, + IMPACTSOUND_SAND, + IMPACTSOUND_SNOW, + IMPACTSOUND_WOOD } impactSound_t; //================================================= @@ -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; @@ -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; @@ -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; @@ -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 */ @@ -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); @@ -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; diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c index d1e38dd..fa99267 100644 --- a/code/cgame/cg_main.c +++ b/code/cgame/cg_main.c @@ -135,6 +135,7 @@ vmCvar_t cg_brassTime; vmCvar_t cg_viewsize; vmCvar_t cg_viewnudge; // leilei vmCvar_t cg_muzzleflashStyle; +vmCvar_t cg_alternateShell; vmCvar_t cg_drawGun; vmCvar_t cg_gun_frame; vmCvar_t cg_gun_x; @@ -251,7 +252,7 @@ vmCvar_t cl_timeNudge; //elimination addition vmCvar_t cg_alwaysWeaponBar; -vmCvar_t cg_hitsound; +vmCvar_t cg_hitSound; vmCvar_t cg_voip_teamonly; vmCvar_t cg_voteflags; vmCvar_t cg_cyclegrapple; @@ -394,7 +395,7 @@ static cvarTable_t cvarTable[] = {// bk001129 { &cg_paused, "cl_paused", "0", CVAR_ROM}, { &cg_blood, "com_blood", "1", CVAR_ARCHIVE}, { &cg_alwaysWeaponBar, "cg_alwaysWeaponBar", "0", CVAR_ARCHIVE}, //Elimination - { &cg_hitsound, "cg_hitsound", "0", CVAR_ARCHIVE}, + { &cg_hitSound, "cg_hitSound", "1", CVAR_ARCHIVE}, { &cg_voip_teamonly, "cg_voipTeamOnly", "1", CVAR_ARCHIVE}, { &cg_voteflags, "cg_voteflags", "*", CVAR_ROM}, { &cg_cyclegrapple, "cg_cyclegrapple", "1", CVAR_ARCHIVE}, @@ -517,6 +518,7 @@ static cvarTable_t cvarTable[] = {// bk001129 {&cg_chatBeep, "cg_chatBeep", "1", CVAR_ARCHIVE}, {&cg_teamChatBeep, "cg_teamChatBeep", "1", CVAR_ARCHIVE}, { &cg_muzzleflashStyle, "cg_muzzleflashStyle", "1", CVAR_ARCHIVE}, + { &cg_alternateShell, "cg_alternateShell", "0", CVAR_ARCHIVE}, /* Neon_Knight: Enables MP checks. */ { &cg_missionpackChecks, "missionpackChecks", "1", CVAR_ARCHIVE}, /* /Neon_Knight */ @@ -902,12 +904,7 @@ static void CG_RegisterSounds(void) { cgs.media.talkSound = trap_S_RegisterSound("sound/player/talk.wav", qfalse); cgs.media.landSound = trap_S_RegisterSound("sound/player/land1.wav", qfalse); - switch (cg_hitsound.integer) { - - case 0: - default: - cgs.media.hitSound = trap_S_RegisterSound("sound/feedback/hit.wav", qfalse); - }; + cgs.media.hitSound = trap_S_RegisterSound("sound/feedback/hit.wav", qfalse); #ifdef MISSIONPACK cgs.media.hitSoundHighArmor = trap_S_RegisterSound("sound/feedback/hithi.wav", qfalse); @@ -963,6 +960,27 @@ static void CG_RegisterSounds(void) { Com_sprintf(name, sizeof (name), "sound/player/footsteps/clank%i.wav", i + 1); cgs.media.footsteps[FOOTSTEP_METAL][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/sand%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_SAND][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/wood%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_WOOD][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/gravel%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_GRAVEL][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/snow%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_SNOW][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/foilage%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_FOILAGE][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/ice%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_ICE][i] = trap_S_RegisterSound(name, qfalse); + + Com_sprintf(name, sizeof (name), "sound/player/footsteps/glass%i.wav", i + 1); + cgs.media.footsteps[FOOTSTEP_GLASS][i] = trap_S_RegisterSound(name, qfalse); } // only register the items that the server says we need @@ -1028,33 +1046,7 @@ static void CG_RegisterSounds(void) { cgs.media.hgrenb1aSound = trap_S_RegisterSound("sound/weapons/grenade/hgrenb1a.wav", qfalse); cgs.media.hgrenb2aSound = trap_S_RegisterSound("sound/weapons/grenade/hgrenb2a.wav", qfalse); -#ifdef MISSIONPACK - trap_S_RegisterSound("sound/player/sergei/death1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/death2.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/death3.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/jump1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/pain25_1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/pain75_1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/pain100_1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/falling1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/gasp.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/drown.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/fall1.wav", qfalse); - trap_S_RegisterSound("sound/player/sergei/taunt.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/death1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/death2.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/death3.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/jump1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/pain25_1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/pain75_1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/pain100_1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/falling1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/gasp.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/drown.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/fall1.wav", qfalse); - trap_S_RegisterSound("sound/player/kyonshi/taunt.wav", qfalse); -#endif } diff --git a/code/cgame/cg_players.c b/code/cgame/cg_players.c index e9e6dd0..56be39c 100644 --- a/code/cgame/cg_players.c +++ b/code/cgame/cg_players.c @@ -2197,6 +2197,94 @@ static void CG_PlayerFloatSprite(centity_t *cent, qhandle_t shader) { trap_R_AddRefEntityToScene(&ent); } + +// leilei - Print their name over their head. Through walls. +static void CG_FloatName(centity_t *cent) { +#ifdef MISSIONPACK + int rf; + int them; + clientInfo_t *ci; + refEntity_t ent; + float textsize; + int x, y, w, chaty, vx, vy, sx, sy, tx, ty, nx, ny; + int l, h, i; + vec4_t color; + vec3_t vp; + char *start; + vec3_t not; + trace_t tr; + + float scl = cgs.screenYScale; // OA3 only scales vertically + if (scl<1) scl=1; + + textsize = 0.1875 * scl; // use the tiny pixel font + if (textsize < 0.1875) textsize = 0.1875; + if (textsize > 0.4) textsize = 0.4; // don't allow the huge font + + vp[0] = cent->headpos[0]; + vp[1] = cent->headpos[1]; + vp[2] = cent->headpos[2]; + + color[3] = 1; + + CG_Trace( &tr, cg.refdef.vieworg, not, not, vp, cg.predictedPlayerState.clientNum, MASK_SOLID ); + if (tr.fraction < 1) + color[3] = 0.3f; // fade names through walls + // return; // don't do names not in the view. + + VectorCopy(cg.headpos[cent->currentState.clientNum], vp); + + if (!vp[0] && !vp[1] && !vp[2]) + return; // ain't working + + color[0] = 0; + color[1] = 1; // green is for friend + color[2] = 0; + + vp[2] += 16; + trap_R_GetViewPosition( vp ); + + // It's time to print + x=vp[0]; + y=vp[1]; + + start = cgs.clientinfo[ cent->currentState.clientNum ].name; + + while (1) { + char linebuffer[256]; + + for (l = 0; l < 50; l++) { + if (!start[l] || start[l] == '\n') { + break; + } + linebuffer[l] = start[l]; + } + linebuffer[l] = 0; + + w = CG_Text_Width(linebuffer, 0.25, 0); + h = CG_Text_Height(linebuffer, 0.25, 0); + vx = x; + vy = (cg.refdef.height - y); + if (x<1) x=1; + if (y<1) y=1; + tx = (vx); + ty = vy; + + CG_Text_Paint_3D(tx-32, ty, textsize, color, linebuffer, 0, 0, 0); + y += h + 6; + while (*start && (*start != '\n')) { + start++; + } + if (!*start) { + break; + } + start++; + } + +#endif +} + + /* =============== CG_PlayerSprites @@ -2251,13 +2339,29 @@ static void CG_PlayerSprites(centity_t *cent) { if (!(cent->currentState.eFlags & EF_DEAD) && cg.snap->ps.persistant[PERS_TEAM] == team && CG_IsATeamGametype(cgs.gametype)) { - if (cg_drawFriend.integer) { + if (cg_drawFriend.integer == 2){ // leilei - name tags + cg.headon[ cent->currentState.clientNum ] = 0; + VectorCopy(cent->headpos,cg.headpos[cent->currentState.clientNum]); + cg.headent[ cent->currentState.clientNum ] = *cent; + } + else if (cg_drawFriend.integer) CG_PlayerFloatSprite(cent, cgs.media.friendShader); - } + return; } } +void CG_PlayerSpritesOverWorld(centity_t *cent) { + int team; + + if (!cg.headon[ cent->currentState.clientNum ]){ + CG_FloatName(cent); + cg.headon[ cent->currentState.clientNum ] = 1; // applied directly + } + + +} + /* =============== CG_PlayerShadow @@ -2419,40 +2523,84 @@ void CG_AddRefEntityWithPowerups(refEntity_t *ent, entityState_t *state, int tea trap_R_AddRefEntityToScene(ent); } } else { + if (cg_alternateShell.integer < 2) // leilei - skip the shell for the glow trap_R_AddRefEntityToScene(ent); if (!isMissile && (cgs.dmflags & DF_PLAYER_OVERLAY) && !(state->eFlags & EF_DEAD)) { - switch (team) { - case TEAM_RED: - ent->customShader = cgs.media.redOverlay; - trap_R_AddRefEntityToScene(ent); - break; - case TEAM_BLUE: - ent->customShader = cgs.media.blueOverlay; - trap_R_AddRefEntityToScene(ent); - break; - default: - ent->customShader = cgs.media.neutralOverlay; - trap_R_AddRefEntityToScene(ent); - } + if (cg_alternateShell.integer > 1){ + ent->glow = 1337; + switch (team) { + case TEAM_RED: + ent->glowcol = 0xF80A85; + break; + case TEAM_BLUE: + ent->glowcol = 0x0585FD; + break; + default: + ent->glowcol = 0xA0A0A0; + } + } + else + { + switch (team) { + case TEAM_RED: + ent->customShader = cgs.media.redOverlay; + trap_R_AddRefEntityToScene(ent); + break; + case TEAM_BLUE: + ent->customShader = cgs.media.blueOverlay; + trap_R_AddRefEntityToScene(ent); + break; + default: + ent->customShader = cgs.media.neutralOverlay; + trap_R_AddRefEntityToScene(ent); + } + } } if (state->powerups & (1 << PW_QUAD)) { + if (cg_alternateShell.integer > 1){ + ent->glow = 1338; + if (team == TEAM_RED) + ent->glowcol = 0xFF3040; + else + ent->glowcol = 0x0040E2; + + } + else + { if (team == TEAM_RED) ent->customShader = cgs.media.redQuadShader; else ent->customShader = cgs.media.quadShader; trap_R_AddRefEntityToScene(ent); + } } if (state->powerups & (1 << PW_REGEN)) { if (((cg.time / 100) % 10) == 1) { - ent->customShader = cgs.media.regenShader; - trap_R_AddRefEntityToScene(ent); + if (cg_alternateShell.integer > 1){ + ent->glow = 1337; + ent->glowcol = 0xFF6080; + } + else + { + ent->customShader = cgs.media.regenShader; + trap_R_AddRefEntityToScene(ent); + } } } if (state->powerups & (1 << PW_BATTLESUIT)) { - ent->customShader = cgs.media.battleSuitShader; - trap_R_AddRefEntityToScene(ent); + if (cg_alternateShell.integer > 1){ + ent->glow = 1340; + ent->glowcol = 0xE29000; + } + else + { + ent->customShader = cgs.media.battleSuitShader; + trap_R_AddRefEntityToScene(ent); + } } + if (cg_alternateShell.integer > 1) // NOW add the entity for the glow + trap_R_AddRefEntityToScene(ent); } } @@ -2523,37 +2671,6 @@ void CG_Player(centity_t *cent) { float angle; vec3_t dir, angles; int camereyes = 0; - // leilei - chibi hack - float chibifactorbody = 0.0f; - float chibifactortorso = 0.0f; - float chibifactorhead = 0.0f; - - if (cg_leiChibi.integer > 0) { - if (cg_leiChibi.integer == 1) { - // chibi SD proportion - chibifactortorso = 0.0f; - chibifactorbody = 0.62f; - chibifactorhead = 2.7f; - } else if (cg_leiChibi.integer == 2) { - // slightly younger proportion - chibifactorbody = 0.92f; - chibifactortorso = 0.82f; - chibifactorhead = 1.30f; - } else if (cg_leiChibi.integer == 3) { - // slightly more 'real' proportion - chibifactorbody = 0.92f; - chibifactortorso = 0.97f; - chibifactorhead = 0.92f; - } else if (cg_leiChibi.integer == 4) { - // big torso - chibifactorbody = 0.85f; - chibifactortorso = 1.3f; - chibifactorhead = 0.91f; - } - } else { - chibifactorbody = chibifactortorso = chibifactorhead = 0; // normal scale... - } - // the client number is stored in clientNum. It can't be derived // from the entity number, because a single client may have @@ -2624,14 +2741,6 @@ void CG_Player(centity_t *cent) { VectorCopy(cent->lerpOrigin, legs.lightingOrigin); - // leilei - chibi mode hack - if (chibifactorbody) { - VectorScale(legs.axis[0], chibifactorbody, legs.axis[0]); - VectorScale(legs.axis[1], chibifactorbody, legs.axis[1]); - VectorScale(legs.axis[2], chibifactorbody, legs.axis[2]); - } - - // leilei - q scale hack if (cg_enableQ.integer) { @@ -2758,16 +2867,6 @@ void CG_Player(centity_t *cent) { } - if (chibifactortorso) { - VectorScale(torso.axis[0], chibifactortorso, torso.axis[0]); - VectorScale(torso.axis[1], chibifactortorso, torso.axis[1]); - VectorScale(torso.axis[2], chibifactortorso, torso.axis[2]); - } - - - - - CG_AddRefEntityWithPowerups(&torso, ¢->currentState, ci->team, qfalse); if (cent->currentState.eFlags & EF_KAMIKAZE) { @@ -2983,6 +3082,7 @@ void CG_Player(centity_t *cent) { VectorCopy(cent->lerpOrigin, head.lightingOrigin); CG_PositionRotatedEntityOnTag(&head, &torso, ci->torsoModel, "tag_head"); + VectorCopy(head.origin,cent->headpos); // leilei - copy this position so names/bubbles can work // // add the eyes @@ -3031,16 +3131,6 @@ void CG_Player(centity_t *cent) { head.shadowPlane = shadowPlane; head.renderfx = renderfx; - - // leilei - chibi mode hack - if (chibifactorhead) { - VectorScale(head.axis[0], chibifactorhead, head.axis[0]); - VectorScale(head.axis[1], chibifactorhead, head.axis[1]); - VectorScale(head.axis[2], chibifactorhead, head.axis[2]); - } - - - CG_AddRefEntityWithPowerups(&head, ¢->currentState, ci->team, qfalse); CG_BreathPuffs(cent, &head); diff --git a/code/cgame/cg_public.h b/code/cgame/cg_public.h index caefff0..5a8890e 100644 --- a/code/cgame/cg_public.h +++ b/code/cgame/cg_public.h @@ -183,7 +183,8 @@ typedef enum { CG_TESTPRINTINT, CG_TESTPRINTFLOAT, CG_ACOS, - CG_R_LFX_PARTICLEEFFECT // leilei - particle effects + CG_R_LFX_PARTICLEEFFECT, // leilei - particle effects + CG_R_VIEWPOSITION } cgameImport_t; diff --git a/code/cgame/cg_syscalls.asm b/code/cgame/cg_syscalls.asm index f6f8d9e..ea702a6 100644 --- a/code/cgame/cg_syscalls.asm +++ b/code/cgame/cg_syscalls.asm @@ -103,4 +103,5 @@ equ ceil -109 equ testPrintInt -110 equ testPrintFloat -111 equ acos -112 -equ trap_R_LFX_ParticleEffect -113 +equ trap_R_LFX_ParticleEffect -113 +equ trap_R_GetViewPosition -114 diff --git a/code/cgame/cg_syscalls.c b/code/cgame/cg_syscalls.c index 515988b..c44a5f6 100644 --- a/code/cgame/cg_syscalls.c +++ b/code/cgame/cg_syscalls.c @@ -399,6 +399,10 @@ void trap_R_LFX_ParticleEffect( int effect, const vec3_t origin, const vec3_t ve syscall( CG_R_LFX_PARTICLEEFFECT, effect, origin, velocity ); } +// leilei - get viewmatrix from value +void trap_R_GetViewPosition( vec3_t point ) { + syscall( CG_R_VIEWPOSITION, point ); +} // this returns a handle. arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate) int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits) { diff --git a/code/cgame/cg_weapons.c b/code/cgame/cg_weapons.c index 3329d1c..87e61fb 100644 --- a/code/cgame/cg_weapons.c +++ b/code/cgame/cg_weapons.c @@ -1572,16 +1572,33 @@ static void CG_AddWeaponWithPowerups( refEntity_t *gun, int powerups ) } } else { + if (cg_alternateShell.integer < 2) // leilei - skip the shell for the glow trap_R_AddRefEntityToScene( gun ); if ( powerups & ( 1 << PW_BATTLESUIT ) ) { - gun->customShader = cgs.media.battleWeaponShader; - trap_R_AddRefEntityToScene( gun ); + if (cg_alternateShell.integer > 1){ + gun->glow = 1340; + gun->glowcol = 0xE29000; + } + else + { + gun->customShader = cgs.media.battleWeaponShader; + trap_R_AddRefEntityToScene( gun ); + } } if ( powerups & ( 1 << PW_QUAD ) ) { - gun->customShader = cgs.media.quadWeaponShader; - trap_R_AddRefEntityToScene( gun ); + if (cg_alternateShell.integer > 1){ + gun->glow = 1338; + gun->glowcol = 0x0040E2; + } + else + { + gun->customShader = cgs.media.quadWeaponShader; + trap_R_AddRefEntityToScene( gun ); + } } + if (cg_alternateShell.integer > 1) // NOW add the entity for the glow + trap_R_AddRefEntityToScene( gun ); } } diff --git a/code/game/bg_misc.c b/code/game/bg_misc.c index 790feb8..06787df 100644 --- a/code/game/bg_misc.c +++ b/code/game/bg_misc.c @@ -1539,7 +1539,18 @@ char *eventnames[] = { "EV_DEBUG_LINE", "EV_STOPLOOPINGSOUND", - "EV_TAUNT" + "EV_TAUNT", + "EV_FOOTSTEP_WOOD", + "EV_FOOTSTEP_SNOW", + "EV_FOOTSTEP_SAND", + "EV_FOOTSTEP_GRAVEL", + "EV_FOOTSTEP_FOILAGE", + "EV_FOOTSTEP_ICE", + "EV_FOOTSTEP_GLASS", + "EV_BULLET_HIT_WOOD", + "EV_BULLET_HIT_SAND", + "EV_BULLET_HIT_SNOW", + "EV_BULLET_HIT_GLASS" }; diff --git a/code/game/bg_pmove.c b/code/game/bg_pmove.c index 7daa237..6fa0c09 100644 --- a/code/game/bg_pmove.c +++ b/code/game/bg_pmove.c @@ -940,6 +940,28 @@ static int PM_FootstepForSurface( void ) if ( pml.groundTrace.surfaceFlags & SURF_METALSTEPS ) { return EV_FOOTSTEP_METAL; } + // leilei - additional footsteps + if ( pml.groundTrace.surfaceFlags & SURF_SNOW ) { + return EV_FOOTSTEP_SNOW; + } + if ( pml.groundTrace.surfaceFlags & SURF_WOOD ) { + return EV_FOOTSTEP_WOOD; + } + if ( pml.groundTrace.surfaceFlags & SURF_SAND ) { + return EV_FOOTSTEP_SAND; + } + if ( pml.groundTrace.surfaceFlags & SURF_GRAVEL ) { + return EV_FOOTSTEP_GRAVEL; + } + if ( pml.groundTrace.surfaceFlags & SURF_LEAVES ) { + return EV_FOOTSTEP_FOILAGE; + } + if ( pml.groundTrace.surfaceFlags & SURF_ICE ) { + return EV_FOOTSTEP_ICE; + } + if ( pml.groundTrace.surfaceFlags & SURF_GLASS ) { + return EV_FOOTSTEP_GLASS; + } return EV_FOOTSTEP; } diff --git a/code/game/bg_public.h b/code/game/bg_public.h index bf50149..f436564 100644 --- a/code/game/bg_public.h +++ b/code/game/bg_public.h @@ -502,7 +502,20 @@ typedef enum { EV_TAUNT_FOLLOWME, EV_TAUNT_GETFLAG, EV_TAUNT_GUARDBASE, - EV_TAUNT_PATROL + EV_TAUNT_PATROL, + + // leilei - footsteps + EV_FOOTSTEP_SNOW, + EV_FOOTSTEP_WOOD, + EV_FOOTSTEP_SAND, + EV_FOOTSTEP_GRAVEL, + EV_FOOTSTEP_FOILAGE, + EV_FOOTSTEP_ICE, + EV_FOOTSTEP_GLASS, + EV_BULLET_HIT_WOOD, + EV_BULLET_HIT_SAND, + EV_BULLET_HIT_SNOW, + EV_BULLET_HIT_GLASS } entity_event_t; diff --git a/code/qcommon/surfaceflags.h b/code/qcommon/surfaceflags.h index b7c10a1..34dc41d 100644 --- a/code/qcommon/surfaceflags.h +++ b/code/qcommon/surfaceflags.h @@ -78,3 +78,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define SURF_ALPHASHADOW 0x10000 // do per-pixel light shadow casting in q3map #define SURF_NODLIGHT 0x20000 // don't dlight even if solid (solid lava, skies) #define SURF_DUST 0x40000 // leave a dust trail when walking on this surface +// leilei - new surfaceflags +#define SURF_SNOW 0x80000 +#define SURF_WOOD 0x100000 +#define SURF_SAND 0x200000 +#define SURF_GRAVEL 0x400000 +#define SURF_ICE 0x800000 +#define SURF_GLASS 0x1000000 +#define SURF_LEAVES 0x2000000 diff --git a/code/renderer/tr_types.h b/code/renderer/tr_types.h index aa0e02b..5cb802d 100644 --- a/code/renderer/tr_types.h +++ b/code/renderer/tr_types.h @@ -117,6 +117,8 @@ typedef struct { vec3_t eyepos[2]; // looking from vec3_t eyelook; // looking from + int glow; + int glowcol; } refEntity_t; diff --git a/code/ui/ui_local.h b/code/ui/ui_local.h index a96428d..39976e5 100644 --- a/code/ui/ui_local.h +++ b/code/ui/ui_local.h @@ -209,7 +209,7 @@ extern vmCvar_t ui_developer; #define MAX_EDIT_LINE 256 #define MAX_MENUDEPTH 8 -#define MAX_MENUITEMS 128 // was 96 - rfactory change +#define MAX_MENUITEMS 256 // was 96 - rfactory change #define MTYPE_NULL 0 #define MTYPE_SLIDER 1 @@ -776,8 +776,8 @@ typedef struct { #define GAMES_CTF 4 #define MAPS_PER_TIER 3 #define MAX_TIERS 16 -#define MAX_MODS 64 -#define MAX_DEMOS 256 +#define MAX_MODS 128 +#define MAX_DEMOS 512 #define MAX_MOVIES 256 //#define MAX_PLAYERMODELS 256 #define MAX_PLAYERMODELS 1024 diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index 3c7ec23..e9c2878 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -1977,7 +1977,7 @@ static const char *UI_AIFromName(const char *name) return uiInfo.aliasList[j].ai; } } - return "sergei"; + return "sarge"; } #ifndef MISSIONPACK // bk001206 @@ -2025,7 +2025,7 @@ static const char *UI_OpponentLeaderModel(void) return uiInfo.characterList[i].base; } } - return "sergei"; + return "sarge"; } #endif @@ -4258,6 +4258,9 @@ static void UI_RunMenuScript(char **args) else if (Q_strequal(name, "resetScores") ) { UI_ClearScores(); } + else if (Q_stricmp(name, "updateColors") == 0) { + RefreshHexColors(); + } else if (Q_stricmp(name, "RefreshServers") == 0) { UI_StartServerRefresh(qtrue); UI_BuildServerDisplayList(qtrue, qtrue); @@ -5647,6 +5650,8 @@ static void UI_FeederSelection(float feederID, int index) } else if (feederID == FEEDER_Q3HEADS) { if (index >= 0 && index < uiInfo.q3HeadCount) { + trap_Cvar_Set( "team_model", uiInfo.q3HeadNames[index]); + trap_Cvar_Set( "team_headmodel", uiInfo.q3HeadNames[index]); trap_Cvar_Set( "model", uiInfo.q3HeadNames[index]); trap_Cvar_Set( "headmodel", uiInfo.q3HeadNames[index]); updateModel = qtrue; @@ -5654,6 +5659,8 @@ static void UI_FeederSelection(float feederID, int index) } else if (feederID == FEEDER_Q3HEADS_FULL) { if (index >= 0 && index < uiInfo.q3HeadCount2) { + trap_Cvar_Set( "team_model", uiInfo.q3HeadNames[index]); + trap_Cvar_Set( "team_headmodel", uiInfo.q3HeadNames[index]); trap_Cvar_Set( "model", uiInfo.q3HeadNames2[index]); trap_Cvar_Set( "headmodel", uiInfo.q3HeadNames2[index]); updateModel = qtrue; @@ -5833,10 +5840,10 @@ static qboolean Character_Parse(char **p) uiInfo.characterList[uiInfo.characterCount].imageName = String_Alloc(va("models/players/heads/%s/icon_default.tga", uiInfo.characterList[uiInfo.characterCount].name)); if (tempStr && Q_strequal(tempStr, "female")) { - uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("kyonshi")); + uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("sarge")); } else if (tempStr && Q_strequal(tempStr, "male")) { - uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("sergei")); + uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("sarge")); } else { uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("%s",tempStr)); diff --git a/code/ui/ui_players.c b/code/ui/ui_players.c index 912ce5c..faa685c 100644 --- a/code/ui/ui_players.c +++ b/code/ui/ui_players.c @@ -2041,11 +2041,11 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName // load the animations Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName ); if ( !UI_ParseAnimationFile( filename, pi ) ) { - Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/animation.cfg", modelName ); - if ( !UI_ParseAnimationFile( filename, pi ) ) { +// Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/animation.cfg", modelName ); +// if ( !UI_ParseAnimationFile( filename, pi ) ) { Com_Printf( "Failed to load animation file %s\n", filename ); - return qfalse; - } +// return qfalse; +// } } // load eyes diff --git a/code/ui/ui_shared.c b/code/ui/ui_shared.c index 118e39a..7b3ecc1 100644 --- a/code/ui/ui_shared.c +++ b/code/ui/ui_shared.c @@ -269,6 +269,9 @@ static void PC_SourceError(int handle, const char *format, ...) { va_list argptr; static char string[4096]; + // leilei - suppress on non-developer mode because we do a lot of tricks that make errors upset.... + if (DC->getCVarValue("developer")) + { va_start(argptr, format); Q_vsnprintf(string, sizeof (string), format, argptr); va_end(argptr); @@ -278,6 +281,7 @@ static void PC_SourceError(int handle, const char *format, ...) { trap_PC_SourceFileAndLine(handle, filename, &line); Com_Printf(S_COLOR_RED "ERROR: %s, line %d: %s\n", filename, line, string); + } } /* @@ -4408,6 +4412,13 @@ void Item_Model_Paint(itemDef_t *item) { ent.renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW; VectorCopy(ent.origin, ent.oldorigin); + // leilei - colorable models + if (item->window.flags & WINDOW_FORECOLORSET) { + ent.shaderRGBA[0] = item->window.foreColor[0] * 255; + ent.shaderRGBA[1] = item->window.foreColor[1] * 255; + ent.shaderRGBA[2] = item->window.foreColor[2] * 255; + + } DC->addRefEntityToScene(&ent); // changed RD @@ -4951,6 +4962,7 @@ qboolean Menus_AnyFullScreenVisible(void) { return qfalse; } +void RefreshHexColors ( void ); menuDef_t *Menus_ActivateByName(const char *p) { int i; menuDef_t *m = NULL; @@ -5696,6 +5708,12 @@ qboolean ItemParse_textstyle(itemDef_t *item, int handle) { } +qboolean ItemParse_bitflag(itemDef_t *item, int handle) { + if (!PC_Int_Parse(handle, &item->bitflag)) { + return qfalse; + } + return qtrue; +} // Changed RD qboolean ItemParse_boxcolor(itemDef_t *item, int handle) { @@ -5766,14 +5784,16 @@ static char *Both_Cvar_VariableString( const char *var_name ) { return buffer; } -#define MAX_HEXCOLORS 8 +#define MAX_HEXCOLORS 16 vec4_t hexcol[MAX_HEXCOLORS]; void UpdateHexColors ( void ){ // Parse ui_colors to update our vectors from the hex values in the cvar const char *token; int col[MAX_HEXCOLORS]; - int i; + int i, j, k; + menuDef_t *menu; + char *thecolors = Both_Cvar_VariableString("ui_colors"); for (i=0;i> 8 ) & 0xFF) / 255; hexcol[i][2] = (float)(col[i] & 0xFF) / 255; } + + + } + +void ItemRefresh_hexcolor(itemDef_t *item) { + int i; + int j; + float f; + int hecks[MAX_HEXCOLORS]; + UpdateHexColors(); + for (j = 0; j < 3; j++) { // ignore alpha + item->window.backColor[j] = hexcol[item->window.choshex[0]][j]; + item->window.foreColor[j] = hexcol[item->window.choshex[1]][j]; + item->window.outlineColor[j] = hexcol[item->window.choshex[2]][j]; + item->window.borderColor[j] = hexcol[item->window.choshex[3]][j]; + } +} + + qboolean ItemParse_hexcolor(itemDef_t *item, int handle) { int i; int j; float f; - int hecks[4]; + int hecks[MAX_HEXCOLORS]; UpdateHexColors(); // TODO: Move to a uiscript command so scheme changes // can update everything @@ -5812,27 +5851,52 @@ qboolean ItemParse_hexcolor(itemDef_t *item, int handle) { // // - for (i = 0; i < 4; i++) { + for (i = 0; i < 3; i++) { if (!PC_Float_Parse(handle, &f)) { return qfalse; } hecks[i] = (int)f; - } + } + + item->window.choshex[0] = hecks[0]; + item->window.choshex[1] = hecks[1]; + item->window.choshex[2] = hecks[2]; + item->window.choshex[3] = hecks[3]; + item->window.flags |= WINDOW_HEXCOLORSET; - - for (i = 0; i < 4; i++) { - for (j = 0; j < 3; j++) { // ignore alpha - item->window.backColor[j] = hexcol[hecks[0]][j]; - item->window.foreColor[j] = hexcol[hecks[1]][j]; - item->window.outlineColor[j] = hexcol[hecks[2]][j]; - item->window.borderColor[j] = hexcol[hecks[3]][j]; - } - + for (j = 0; j < 3; j++) { // ignore alpha + item->window.backColor[j] = hexcol[hecks[0]][j]; + item->window.foreColor[j] = hexcol[hecks[1]][j]; + item->window.outlineColor[j] = hexcol[hecks[2]][j]; + item->window.borderColor[j] = hexcol[hecks[3]][j]; } return qtrue; } +void RefreshHexColors ( void ){ + // Parse ui_colors to update our vectors from the hex values in the cvar + const char *token; + int col[MAX_HEXCOLORS]; + int i, j, k; + menuDef_t *menu; + + // Now go through all of the menu options and check their hex colors and change them all + for (i = 0; i < Menu_Count(); i++) { + menu = &Menus[i]; + if (menu != NULL) { + for (j = 0; j < menu->itemCount; j++) { + if (menu->items[j]->window.flags & WINDOW_HEXCOLORSET) { + ItemRefresh_hexcolor(menu->items[j]); + } + } + } + } + + +} + + qboolean ItemParse_bordercolor(itemDef_t *item, int handle) { int i; float f; @@ -6361,6 +6425,7 @@ keywordHash_t itemParseKeywords[] = { {"cinematic", ItemParse_cinematic, NULL}, {"doubleclick", ItemParse_doubleClick, NULL}, {"hexcolor", ItemParse_hexcolor, NULL}, + {"bitflag", ItemParse_bitflag, NULL}, {NULL, 0, NULL} }; diff --git a/code/ui/ui_shared.h b/code/ui/ui_shared.h index b88b704..d6d8526 100644 --- a/code/ui/ui_shared.h +++ b/code/ui/ui_shared.h @@ -33,10 +33,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_ITEMTEXT 64 #define MAX_ITEMACTION 64 #define MAX_MENUDEFFILE 4096 -#define MAX_MENUFILE 32768 +#define MAX_MENUFILE 65535 #define MAX_MENUS 64 // Changed RD -#define MAX_MENUITEMS 128 +#define MAX_MENUITEMS 256 #define MAX_SCRIPTSIZE 4096 // end changed RD #define MAX_COLOR_RANGES 10 @@ -165,6 +165,7 @@ typedef struct { vec4_t outlineColor; // border color qhandle_t background; // background asset vec4_t hexColor; // leilei - defined colors + int choshex[16]; // leilei - chosen hex colors } windowDef_t; typedef windowDef_t Window; @@ -316,6 +317,7 @@ typedef struct itemDef_s { float scralignfactor; // leilei - factor of adjustment int viewsizemin; // leilei - hide this if viewsize int viewsizemax; // leilei - hide this if viewsize + int bitflag; // leilei - check for bits } itemDef_t; typedef struct {