diff --git a/.clang-format b/.clang-format index 357ed84..34e8d25 100644 --- a/.clang-format +++ b/.clang-format @@ -5,4 +5,4 @@ ColumnLimit: 160 SortIncludes: Never --- Language: Cpp -Standard: c++14 +Standard: c++17 diff --git a/SConstruct b/SConstruct index 1a3ba78..d3820c4 100644 --- a/SConstruct +++ b/SConstruct @@ -28,7 +28,7 @@ # NO_SSE disable SSE floating point instructions, force x87 fpu # MORE_WARNINGS enable additional warnings # LESS_WARNINGS disable some default warnings -# SCONS_DEBUG disable some default warnings +# SCONS_DEBUG debug logging for scons env/tool selection # import platform @@ -444,13 +444,13 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: # c flags env["CFLAGS"] += [ - "-std=gnu99", + "-std=c17", ] # c++ flags env["CXXFLAGS"] += [ "-fvisibility-inlines-hidden", - "-std=c++14", + "-std=c++17", ] # archive flags @@ -555,6 +555,16 @@ elif env["CC"] == "cl": "/wd 4996", ] + # c flags + env["CFLAGS"] += [ + "/std:c17", + ] + + # c++ flags + env["CXXFLAGS"] += [ + "/std:c++17", + ] + env["LINKFLAGS"] += [ #'/NODEFAULTLIB:LIBCMTD', #'/NODEFAULTLIB:MSVCRT', diff --git a/cgame/cg_consolecmds.cpp b/cgame/cg_consolecmds.cpp index 83da252..0e7cd4b 100644 --- a/cgame/cg_consolecmds.cpp +++ b/cgame/cg_consolecmds.cpp @@ -339,7 +339,7 @@ void CG_FixDirection(void) { cg.japp.fixedVector.z = 0; cg.japp.isfixedVector = qtrue; - trap->Print("Direction set (%.3f,%.3f).\n", cg.japp.fixedVector.x, cg.japp.fixedVector.y); + trap->Print("Direction set (%.3f,%.3f).\n", (double)cg.japp.fixedVector.x, (double)cg.japp.fixedVector.y); } void CG_SayTeam_f(void) { diff --git a/cgame/cg_draw.cpp b/cgame/cg_draw.cpp index eea5c35..12ff9a1 100644 --- a/cgame/cg_draw.cpp +++ b/cgame/cg_draw.cpp @@ -232,10 +232,10 @@ static void CG_DrawZoomMask(void) { // CG_DrawPic( 198, 118, 246, 246, media.gfx.interface.disruptor.light ); if ((cg.snap->ps.eFlags & EF_DOUBLE_AMMO)) { - ammo_t ammoIndex = weaponData[WP_DISRUPTOR].ammoIndex; + ammo_e ammoIndex = weaponData[WP_DISRUPTOR].ammoIndex; max = cg.snap->ps.ammo[ammoIndex] / ((float)ammoMax[ammoIndex] * 2.0f); } else { - ammo_t ammoIndex = weaponData[WP_DISRUPTOR].ammoIndex; + ammo_e ammoIndex = weaponData[WP_DISRUPTOR].ammoIndex; max = cg.snap->ps.ammo[ammoIndex] / (float)ammoMax[ammoIndex]; } if (max > 1.0f) @@ -655,7 +655,7 @@ static void CG_DrawAmmo(centity_t *cent, menuDef_t *menuHUD) { focusItem = Menu_FindItemByName(menuHUD, "ammoamount"); trap->R_SetColor(&colorTable[CT_WHITE]); if (focusItem) { - ammo_t ammoIndex = weaponData[cent->currentState.weapon].ammoIndex; + ammo_e ammoIndex = weaponData[cent->currentState.weapon].ammoIndex; if ((cent->currentState.eFlags & EF_DOUBLE_AMMO)) { inc = (float)(ammoMax[ammoIndex] * 2.0f) / MAX_HUD_TICS; } else { @@ -828,14 +828,14 @@ static void JP_DrawStats(void) { } // Speedometer - Com_sprintf(speedStr, sizeof(speedStr), "%s%04.01f ups", (speed >= 800.0f ? S_COLOR_RED : (speed >= 550.0f ? S_COLOR_YELLOW : S_COLOR_WHITE)), speed); + Com_sprintf(speedStr, sizeof(speedStr), "%s%04.01f ups", (speed >= 800.0f ? S_COLOR_RED : (speed >= 550.0f ? S_COLOR_YELLOW : S_COLOR_WHITE)), + (double)speed); - const char *statStr = - va("%-12s%i\n%-12s%i\n%-12s%.2f\n\n%-12s%i\n%-12s%i\n\n%-12s%s\n%-12s%s\n\n%-12s%s", "Score", cg.snap->ps.persistant[PERS_SCORE], "Deaths", - cg.snap->ps.persistant[PERS_KILLED], "Ratio", - cg.snap->ps.persistant[PERS_KILLED] ? (float)((float)cg.snap->ps.persistant[PERS_SCORE] / (float)cg.snap->ps.persistant[PERS_KILLED]) - : (float)cg.snap->ps.persistant[PERS_SCORE], - "Ping", ping, "FPS", cg.japp.fps, "Local time", localTimeStr, "Map Time", mapTimeStr, "Speed", speedStr); + const char *statStr = va("%-12s%i\n%-12s%i\n%-12s%.2f\n\n%-12s%i\n%-12s%i\n\n%-12s%s\n%-12s%s\n\n%-12s%s", "Score", cg.snap->ps.persistant[PERS_SCORE], + "Deaths", cg.snap->ps.persistant[PERS_KILLED], "Ratio", + cg.snap->ps.persistant[PERS_KILLED] ? (double)(cg.snap->ps.persistant[PERS_SCORE] / (float)cg.snap->ps.persistant[PERS_KILLED]) + : (double)cg.snap->ps.persistant[PERS_SCORE], + "Ping", ping, "FPS", cg.japp.fps, "Local time", localTimeStr, "Map Time", mapTimeStr, "Speed", speedStr); const Font font(FONT_JAPPMONO, cg_hudStatsScale.value, false); font.Paint(cg.statsPos.x, cg.statsPos.y, statStr, &colorWhite, uiTextStyle_e::Outlined); @@ -1181,7 +1181,7 @@ void CG_DrawHUD(centity_t *cent) { ps->saberMove, ps->legsAnim, ps->torsoAnim, ps->legsTimer, ps->torsoTimer, ps->groundEntityNum, ps->duelIndex, ps->duelInProgress, ps->eFlags, ps->eFlags2, ps->activeForcePass, ps->generic1, ps->genericEnemyIndex, ps->pm_flags, ps->pm_type, ps->ragAttach, ps->fd.forcePowerSelected, - ps->fd.forcePowersKnown, ps->speed, + ps->fd.forcePowersKnown, (double)ps->speed, es->bolt1, es->bolt2, es->generic1, es->genericenemyindex, @@ -2099,7 +2099,7 @@ void CG_DrawVehicleArmor(const menuDef_t *menuHUD, const centity_t *veh) { } } -enum { +enum vehDamageLocation_e { VEH_DAMAGE_FRONT = 0, VEH_DAMAGE_BACK, VEH_DAMAGE_LEFT, @@ -2629,7 +2629,7 @@ static float CG_DrawFPS(float y) { y += font.Height(s); } if (cg_drawFPS.integer == 2) { - s = va("%i/%3.2f msec", frameTime, 1000.0f / (float)fps); + s = va("%i/%3.2f msec", frameTime, (double)(1000.0f / (float)fps)); w = font.Width(s); font.Paint(SCREEN_WIDTH - w, y, s, &g_color_table[ColorIndex(COLOR_GREY)], uiTextStyle_e::Shadowed); @@ -3297,7 +3297,7 @@ static float CG_DrawTeamOverlay(float y, qboolean right, qboolean upper) { for (j = 0; j <= PW_NUM_POWERUPS; j++) { if (ci->powerups & (1 << j)) { - item = BG_FindItemForPowerup((powerup_t)j); + item = BG_FindItemForPowerup((powerup_e)j); if (item) { CG_DrawPic(xx + xOffset, y, TINYCHAR_WIDTH * cgs.widthRatioCoef, TINYCHAR_HEIGHT, trap->R_RegisterShader(item->icon)); @@ -3329,7 +3329,7 @@ static void CG_DrawPowerupIcons(int y) { for (int j = 0; j < PW_NUM_POWERUPS; j++) { if (cg.snap->ps.powerups[j] > cg.time) { - const gitem_t *item = BG_FindItemForPowerup((powerup_t)j); + const gitem_t *item = BG_FindItemForPowerup((powerup_e)j); if (item) { qhandle_t icon = NULL_HANDLE; // FIXME: is this hack necessary? investigate icons for the actual items @@ -3632,7 +3632,7 @@ static void CG_DrawLagometer(void) { total += lagometer.frameSamples[i]; } float avgXerp = total / (float)LAG_SAMPLES; - const char *xerpText = va("%04.1f", avgXerp); + const char *xerpText = va("%04.1f", (double)avgXerp); const float xerpWidth = font.Width(xerpText); font.Paint(x + (w * cgs.widthRatioCoef) - xerpWidth, y, xerpText, &colorTable[CT_WHITE], uiTextStyle_e::ShadowedMore); } diff --git a/cgame/cg_effects.cpp b/cgame/cg_effects.cpp index accfe72..86aa67d 100644 --- a/cgame/cg_effects.cpp +++ b/cgame/cg_effects.cpp @@ -864,7 +864,7 @@ void CG_Chunks(int owner, vector3 *origin, const vector3 *normal, const vector3 vector3 dir; int i, j, k; int chunkModel = 0; - leBounceSoundType_t bounce = LEBS_NONE; + leBounceSoundType_e bounce = LEBS_NONE; float r, speedMod = 1.0f; qboolean chunk = qfalse; diff --git a/cgame/cg_ents.cpp b/cgame/cg_ents.cpp index 6aaaeaa..b91c6c4 100644 --- a/cgame/cg_ents.cpp +++ b/cgame/cg_ents.cpp @@ -1631,7 +1631,7 @@ static void CG_Item(centity_t *cent) { ent.renderfx |= RF_FORCE_ENT_ALPHA; // VectorCopy( cent->currentState.angles, angs ); angs.pitch = 0.0f; - angs.yaw = 360.0f * (fmod(cg.time * 0.001f, 360.0f / 128.0f)) / (360.0f / 128.0f); + angs.yaw = 360.0f * (fmodf(cg.time * 0.001f, 360.0f / 128.0f)) / (360.0f / 128.0f); angs.roll = 0.0f; AnglesToAxis(&angs, ent.axis); diff --git a/cgame/cg_event.cpp b/cgame/cg_event.cpp index bb0ec2d..3271286 100644 --- a/cgame/cg_event.cpp +++ b/cgame/cg_event.cpp @@ -78,7 +78,7 @@ static void CG_Obituary(entityState_t *ent) { int mod, target, attacker; const char *message, *targetInfo, *attackerInfo; char targetName[32], attackerName[32]; - gender_t gender; + gender_e gender; clientInfo_t *ci; target = ent->otherEntityNum; @@ -1137,7 +1137,7 @@ void CG_EntityEvent(centity_t *cent, vector3 *position) { case EV_FOOTSTEP: DEBUGNAME("EV_FOOTSTEP"); if (cg_footsteps.integer) { - footstep_t soundType; + footstep_e soundType; switch (es->eventParm) { case MATERIAL_MUD: soundType = FOOTSTEP_MUDWALK; diff --git a/cgame/cg_jappScoreboard.cpp b/cgame/cg_jappScoreboard.cpp index 5dafe8b..8c10e42 100644 --- a/cgame/cg_jappScoreboard.cpp +++ b/cgame/cg_jappScoreboard.cpp @@ -87,7 +87,7 @@ static void DrawServerInfo(float fade, float &finalY) { textWidth = fontNormal.Width(tmp); fontNormal.Paint((SCREEN_WIDTH / 2.0f) - textWidth / 2.0f, finalY, tmp, &colour, uiTextStyle_e::Shadowed); finalY += textHeight; - // FALL THROUGH TO GENERIC TEAM GAME INFO! + [[fallthrough]]; // to generic team game info case GT_TEAM: if (cgs.scores1 == cgs.scores2) { @@ -252,7 +252,7 @@ static void DrawPlayerCount(float fade, float &finalY) { } // number of players on team 'team' -static int PlayerCount(team_t team) { +static int PlayerCount(team_e team) { int count = 0; for (int i = 0; i < cg.numScores; i++) { @@ -392,7 +392,7 @@ static const Column nameColumn{ 0.0f}; // returns number of players on team 'team' -static int ListPlayers_TDM(float fade, float _x, float _y, team_t team) { +static int ListPlayers_TDM(float fade, float _x, float _y, team_e team) { const int playerCount = PlayerCount(team); if (!playerCount) { return 0; @@ -446,7 +446,7 @@ static int ListPlayers_TDM(float fade, float _x, float _y, team_t team) { net = math.floor( math.abs( net ) ) */ - text = va("%.2f", ratio); + text = va("%.2f", (double)ratio); } font.Paint(x, y, text, &white, uiTextStyle_e::ShadowedMore); return true; @@ -510,7 +510,7 @@ static int ListPlayers_TDM(float fade, float _x, float _y, team_t team) { } // returns number of players on team 'team' -static int ListPlayers_CTF(float fade, float _x, float _y, team_t team) { +static int ListPlayers_CTF(float fade, float _x, float _y, team_e team) { const int playerCount = PlayerCount(team); if (!playerCount) { return 0; @@ -659,7 +659,7 @@ static int ListPlayers_CTF(float fade, float _x, float _y, team_t team) { } // render a list of players on team 'team' at 'x', 'y' using relevant information based on gametype -static int ListPlayers_Team(float fade, float x, float y, team_t team) { +static int ListPlayers_Team(float fade, float x, float y, team_e team) { switch (cgs.gametype) { case GT_FFA: case GT_HOLOCRON: @@ -790,7 +790,7 @@ static void DrawPlayers_Free(float fade, float &finalY) { text = "--"; } else { const float ratio = (score.time != 0) ? (static_cast(score.score) / score.time) : score.score; - text = va("%.2f", ratio); + text = va("%.2f", (double)ratio); } font.Paint(x, y, text, &white, uiTextStyle_e::ShadowedMore); return true; diff --git a/cgame/cg_local.h b/cgame/cg_local.h index 662e257..65b92fd 100644 --- a/cgame/cg_local.h +++ b/cgame/cg_local.h @@ -107,7 +107,7 @@ #define HUDEVENT_SCORES (0x04u) #define HUDEVENT_ALL (0x07u) -typedef enum footstep_e { +enum footstep_e { FOOTSTEP_STONEWALK, FOOTSTEP_STONERUN, FOOTSTEP_METALWALK, @@ -134,9 +134,9 @@ typedef enum footstep_e { FOOTSTEP_WOODWALK, FOOTSTEP_WOODRUN, FOOTSTEP_TOTAL -} footstep_t; +}; -typedef enum impactSound_e { IMPACTSOUND_DEFAULT, IMPACTSOUND_METAL, IMPACTSOUND_FLESH } impactSound_t; +enum impactSound_e { IMPACTSOUND_DEFAULT, IMPACTSOUND_METAL, IMPACTSOUND_FLESH }; // player entities need to track more information than any other type of entity. // note that not every player entity is a client entity, because corpses after respawn are outside the normal client @@ -180,7 +180,7 @@ typedef struct clientInfo_s { void *ghoul2Weapons[MAX_SABERS]; char saberName[64], saber2Name[64]; char name[MAX_QPATH]; - team_t team; + team_e team; int duelTeam; int botSkill; // -1 = not bot, 0-5 = bot int frame; @@ -206,7 +206,7 @@ typedef struct clientInfo_s { qboolean newAnims; // true if using the new mission pack animations qboolean fixedlegs, fixedtorso; // true if legs yaw is always the same as torso yaw, true if torso never changes yaw vector3 headOffset; // move head in icon views - gender_t gender; // from model + gender_e gender; // from model qhandle_t legsModel, legsSkin; qhandle_t torsoModel, torsoSkin; void *ghoul2Model; @@ -322,7 +322,7 @@ typedef struct markPoly_s { polyVert_t verts[MAX_VERTS_ON_POLY]; } markPoly_t; -typedef enum leType_e { +enum leType_e { LE_MARK, LE_EXPLOSION, LE_SPRITE_EXPLOSION, @@ -337,21 +337,15 @@ typedef enum leType_e { LE_OLINE, LE_SHOWREFENTITY, LE_LINE -} leType_t; +}; -typedef enum leMarkType_e { LEMT_NONE, LEMT_BURN, LEMT_BLOOD } leMarkType_t; // fragment local entities can leave marks on walls +enum leMarkType_e { LEMT_NONE, LEMT_BURN, LEMT_BLOOD }; // fragment local entities can leave marks on walls -typedef enum leBounceSoundType_e { - LEBS_NONE, - LEBS_BLOOD, - LEBS_BRASS, - LEBS_METAL, - LEBS_ROCK -} leBounceSoundType_t; // fragment local entities can make sounds on impacts +enum leBounceSoundType_e { LEBS_NONE, LEBS_BLOOD, LEBS_BRASS, LEBS_METAL, LEBS_ROCK }; // fragment local entities can make sounds on impacts typedef struct localEntity_s { struct localEntity_s *prev, *next; - leType_t leType; + leType_e leType; uint32_t leFlags; int startTime, endTime; int fadeInTime; @@ -365,8 +359,8 @@ typedef struct localEntity_s { float radius; float light; vector3 lightColor; - leMarkType_t leMarkType; // mark to leave on fragment impact - leBounceSoundType_t leBounceSoundType; + leMarkType_e leMarkType; // mark to leave on fragment impact + leBounceSoundType_e leBounceSoundType; union { struct { @@ -496,7 +490,7 @@ typedef struct chatBoxItem_s { int lines; } chatBoxItem_t; -typedef enum refdefView_e { +enum refdefView_e { REFDEF_DEFAULT = 0, REFDEF_AUTOMAP, #ifdef ENABLE_ALTVIEW @@ -504,7 +498,7 @@ typedef enum refdefView_e { #endif REFDEF_SCOREBOARD, REFDEF_MAX -} refdefViews_t; +}; typedef struct cg_s { int clientFrame; // incremented each frame @@ -550,7 +544,7 @@ typedef struct cg_s { vector3 autoAngles, autoAnglesFast; vector3 autoAxis[3], autoAxisFast[3]; refdef_t refdef[REFDEF_MAX]; - refdefViews_t currentRefdef; // Raz: Added + refdefView_e currentRefdef; // Raz: Added qboolean zoomed; int zoomTime; float zoomSensitivity; @@ -744,17 +738,7 @@ typedef struct cgscreffects_s { qboolean music_volume_set; } cgscreffects_t; -typedef enum chunkModels_e { - CHUNK_METAL1 = 0, - CHUNK_METAL2, - CHUNK_ROCK1, - CHUNK_ROCK2, - CHUNK_ROCK3, - CHUNK_CRATE1, - CHUNK_CRATE2, - CHUNK_WHITE_METAL, - NUM_CHUNK_TYPES -} chunkModels_t; +enum chunkModels_e { CHUNK_METAL1 = 0, CHUNK_METAL2, CHUNK_ROCK1, CHUNK_ROCK2, CHUNK_ROCK3, CHUNK_CRATE1, CHUNK_CRATE2, CHUNK_WHITE_METAL, NUM_CHUNK_TYPES }; // The client game static (cgs) structure hold everything loaded or calculated from the gamestate. It will NOT be cleared // when a tournament restart is done, allowing all clients to begin playing instantly @@ -767,7 +751,7 @@ typedef struct cgs_s { qboolean localServer; // detected on startup by checking sv_running int siegeTeamSwitch; int showDuelHealths; - gametype_t gametype; + gametype_e gametype; int debugMelee; int stepSlideFix; int noSpecMove; @@ -922,7 +906,7 @@ qboolean CG_DeferMenuScript(char **args); void CG_DestroyNPCClient(clientInfo_t **ci); void CG_Draw3DModel(float x, float y, float w, float h, qhandle_t model, void *ghoul2, int g2radius, qhandle_t skin, vector3 *origin, vector3 *angles); void CG_DrawActive(void); -void CG_DrawActiveFrame(int serverTime, stereoFrame_t stereoView, qboolean demoPlayback); +void CG_DrawActiveFrame(int serverTime, stereoFrame_e stereoView, qboolean demoPlayback); void CG_DrawBigString(int x, int y, const char *s, float alpha); void CG_DrawBigStringColor(int x, int y, const char *s, const vector4 *color); void CG_DrawFlagModel(float x, float y, float w, float h, int team, qboolean force2D); @@ -961,16 +945,16 @@ void CG_G2Trace(trace_t *result, const vector3 *start, const vector3 *mins, cons qboolean CG_G2TraceCollide(trace_t *tr, const vector3 *mins, const vector3 *maxs, vector3 *lastValidStart, vector3 *lastValidEnd); void *CG_G2WeaponInstance(centity_t *cent, int weapon); uint32_t CG_GetCameraClip(void); -int CG_GetClassCount(team_t team, int siegeClass); +int CG_GetClassCount(team_e team, int siegeClass); void CG_GetColorForHealth(int health, int armor, vector4 *hcolor); -flagStatus_t CG_GetFlagStatus(team_t team); +flagStatus_t CG_GetFlagStatus(team_e team); const char *CG_GetGameStatusText(void); const char *CG_GetKillerText(void); const char *CG_GetLocationString(const char *loc); refdef_t *CG_GetRefdef(void); const char *CG_GetStringEdString(const char *refSection, const char *refName); void CG_GetTeamColor(vector4 *color); -int CG_GetTeamNonScoreCount(team_t team); +int CG_GetTeamNonScoreCount(team_e team); float CG_GetValue(int ownerDraw); void CG_GetWeaponMuzzleBolt(int clIndex, vector3 *to); void CG_GlassShatter(int entnum, vector3 *dmgPt, vector3 *dmgDir, float dmgRadius, int maxShards); @@ -1004,7 +988,7 @@ localEntity_t *CG_MakeExplosion(vector3 *origin, vector3 *dir, qhandle_t hModel, uint32_t flags); void CG_ManualEntityRender(centity_t *cent); void CG_MissileHitPlayer(int weapon, vector3 *origin, vector3 *dir, int entityNum, qboolean alt_fire); -void CG_MissileHitWall(int weapon, int clientNum, vector3 *origin, vector3 *dir, impactSound_t soundType, qboolean alt_fire, int charge); +void CG_MissileHitWall(int weapon, int clientNum, vector3 *origin, vector3 *dir, impactSound_e soundType, qboolean alt_fire, int charge); void CG_MiscModelExplosion(vector3 *mins, vector3 *maxs, int size, material_t chunkType); void CG_MouseEvent(int dx, int dy); void CG_NextForcePower_f(void); diff --git a/cgame/cg_lualocalentity.cpp b/cgame/cg_lualocalentity.cpp index ebe63fa..3e0be53 100644 --- a/cgame/cg_lualocalentity.cpp +++ b/cgame/cg_lualocalentity.cpp @@ -45,7 +45,7 @@ int LocalEntity_Create(lua_State *L) { return 1; } -static void LocalEntity_SetType(lua_State *L, localEntity_t *ent) { ent->leType = (leType_t)luaL_checkinteger(L, 3); } +static void LocalEntity_SetType(lua_State *L, localEntity_t *ent) { ent->leType = (leType_e)luaL_checkinteger(L, 3); } static int LocalEntity_GetType(lua_State *L, localEntity_t *ent) { lua_pushinteger(L, ent->leType); @@ -160,14 +160,14 @@ static int LocalEntity_GetLightColor(lua_State *L, localEntity_t *ent) { return 1; } -static void LocalEntity_SetMarkType(lua_State *L, localEntity_t *ent) { ent->leMarkType = (leMarkType_t)luaL_checkinteger(L, 3); } +static void LocalEntity_SetMarkType(lua_State *L, localEntity_t *ent) { ent->leMarkType = (leMarkType_e)luaL_checkinteger(L, 3); } static int LocalEntity_GetMarkType(lua_State *L, localEntity_t *ent) { lua_pushinteger(L, ent->leMarkType); return 1; } -static void LocalEntity_SetBSndType(lua_State *L, localEntity_t *ent) { ent->leBounceSoundType = (leBounceSoundType_t)luaL_checkinteger(L, 3); } +static void LocalEntity_SetBSndType(lua_State *L, localEntity_t *ent) { ent->leBounceSoundType = (leBounceSoundType_e)luaL_checkinteger(L, 3); } static int LocalEntity_GetBSndType(lua_State *L, localEntity_t *ent) { lua_pushinteger(L, ent->leBounceSoundType); diff --git a/cgame/cg_luarefentity.cpp b/cgame/cg_luarefentity.cpp index 2643f77..a7dc5eb 100644 --- a/cgame/cg_luarefentity.cpp +++ b/cgame/cg_luarefentity.cpp @@ -54,7 +54,7 @@ static int RefEntity_Free(lua_State *L) { return 0; } -static void RefEntity_SetReType(lua_State *L, refEntity_t *ent) { ent->reType = (refEntityType_t)luaL_checkinteger(L, 3); } +static void RefEntity_SetReType(lua_State *L, refEntity_t *ent) { ent->reType = (refEntityType_e)luaL_checkinteger(L, 3); } static int RefEntity_GetReType(lua_State *L, refEntity_t *ent) { lua_pushinteger(L, ent->reType); diff --git a/cgame/cg_main.cpp b/cgame/cg_main.cpp index e914a82..5173691 100644 --- a/cgame/cg_main.cpp +++ b/cgame/cg_main.cpp @@ -771,8 +771,8 @@ static void CG_RegisterClients(void) { } const char *CG_ConfigString(int index) { - // don't read configstrings before initialisation - assert( cgs.gameState.dataCount != 0 ); + // don't read configstrings before initialisation + assert(cgs.gameState.dataCount != 0); if (index < 0 || index >= MAX_CONFIGSTRINGS) { trap->Error(ERR_DROP, "CG_ConfigString: bad index: %i", index); @@ -1857,7 +1857,7 @@ void CG_Init(int serverMessageNum, int serverCommandSequence, int clientNum, qbo } CG_UpdateServerHistory(); - BG_FixSaberMoveData(); + BG_FixSaberMoveData(); } // makes sure returned string is in localized format @@ -2264,7 +2264,7 @@ Q_CABI { return CG_ConsoleCommand(); case CG_DRAW_ACTIVE_FRAME: - CG_DrawActiveFrame(arg0, (stereoFrame_t)arg1, (qboolean)arg2); + CG_DrawActiveFrame(arg0, (stereoFrame_e)arg1, (qboolean)arg2); return 0; case CG_CROSSHAIR_PLAYER: diff --git a/cgame/cg_newDraw.cpp b/cgame/cg_newDraw.cpp index 242a041..45c3a8b 100644 --- a/cgame/cg_newDraw.cpp +++ b/cgame/cg_newDraw.cpp @@ -88,7 +88,7 @@ float CG_GetValue(int ownerDraw) { // results are valid only for gametypes GT_CTF, GT_CTY and teams TEAM_RED, TEAM_BLUE // else FLAG_ATBASE is returned -flagStatus_t CG_GetFlagStatus(team_t team) { +flagStatus_t CG_GetFlagStatus(team_e team) { if (cgs.gametype >= GT_CTF) { if (team == TEAM_RED) { return cgs.redflag; @@ -105,7 +105,7 @@ bool CG_OtherTeamHasFlag(void) { return false; } - const team_t team = (team_t)cg.snap->ps.persistant[PERS_TEAM]; + const team_e team = (team_e)cg.snap->ps.persistant[PERS_TEAM]; const flagStatus_t status = CG_GetFlagStatus(team); return status == FLAG_TAKEN; } @@ -115,7 +115,7 @@ bool CG_YourTeamHasFlag(void) { return false; } - const team_t team = BG_GetOpposingTeam((team_t)cg.snap->ps.persistant[PERS_TEAM]); + const team_e team = BG_GetOpposingTeam((team_e)cg.snap->ps.persistant[PERS_TEAM]); const flagStatus_t status = CG_GetFlagStatus(team); return status == FLAG_TAKEN; } @@ -125,7 +125,7 @@ bool CG_OtherTeamDroppedFlag(void) { return false; } - const team_t team = BG_GetOpposingTeam((team_t)cg.snap->ps.persistant[PERS_TEAM]); + const team_e team = BG_GetOpposingTeam((team_e)cg.snap->ps.persistant[PERS_TEAM]); const flagStatus_t status = CG_GetFlagStatus(team); return status == FLAG_DROPPED; } @@ -135,7 +135,7 @@ bool CG_YourTeamDroppedFlag(void) { return false; } - const team_t team = BG_GetOpposingTeam((team_t)cg.snap->ps.persistant[PERS_TEAM]); + const team_e team = BG_GetOpposingTeam((team_e)cg.snap->ps.persistant[PERS_TEAM]); const flagStatus_t status = CG_GetFlagStatus(team); return status == FLAG_DROPPED; } @@ -323,7 +323,7 @@ void CG_DrawNewTeamInfo(rectDef_t *rect, float text_x, float text_y, float scale xx = rect->x + 1; for (j = 0; j <= PW_NUM_POWERUPS; j++) { if (ci->powerups & (1 << j)) { - if ((item = BG_FindItemForPowerup((powerup_t)j))) { + if ((item = BG_FindItemForPowerup((powerup_e)j))) { CG_DrawPic(xx, y, PIC_WIDTH, PIC_WIDTH, trap->R_RegisterShader(item->icon)); xx += PIC_WIDTH; } diff --git a/cgame/cg_players.cpp b/cgame/cg_players.cpp index b9b83f6..6249728 100644 --- a/cgame/cg_players.cpp +++ b/cgame/cg_players.cpp @@ -1,12 +1,12 @@ // cg_players.c -- handle the media and animation for player entities -#include "cg_local.h" +#include "cgame/cg_local.h" #include "Ghoul2/G2.h" -#include "bg_saga.h" -#include "fx_local.h" -#include "bg_luaevent.h" -#include "cg_media.h" -#include "bg_vehicles.h" +#include "game/bg_saga.h" +#include "cgame/fx_local.h" +#include "game/bg_luaevent.h" +#include "cgame/cg_media.h" +#include "game/bg_vehicles.h" #include "JAPP/jp_csflags.h" #include "JAPP/jp_ssflags.h" @@ -470,7 +470,7 @@ int CG_G2EvIndexForModel(void *g2, int animIndex) { #define DEFAULT_NEUTER_SOUNDPATH "chars/mp_generic_male/misc" void CG_LoadCISounds(clientInfo_t *ci, qboolean modelloaded) { fileHandle_t f; - gender_t gender = GENDER_MALE; + gender_e gender = GENDER_MALE; int i = 0, fLen = 0; const char *dir, *s; char soundpath[MAX_QPATH], soundName[1024]; @@ -967,7 +967,7 @@ void CG_NewClientInfo(int clientNum, qboolean entitiesInitialized) { // team v = Info_ValueForKey(configstring, "t"); - newInfo.team = (team_t)atoi(v); + newInfo.team = (team_e)atoi(v); // copy team info out to menu if (clientNum == cg.clientNum) @@ -1328,10 +1328,10 @@ void CG_ActualLoadDeferredPlayers(void) { void CG_LoadDeferredPlayers(void) { cgQueueLoad = qtrue; } #define FOOTSTEP_DISTANCE (32) -static void _PlayerFootStep(const vector3 *origin, const float orientation, const float radius, centity_t *const cent, footstepType_t footStepType) { +static void _PlayerFootStep(const vector3 *origin, const float orientation, const float radius, centity_t *const cent, footstepType_e footStepType) { vector3 end, mins = {-7, -7, 0}, maxs = {7, 7, 2}; trace_t trace; - footstep_t soundType = FOOTSTEP_TOTAL; + footstep_e soundType = FOOTSTEP_TOTAL; qboolean bMark = qfalse; qhandle_t footMarkShader; int effectID = -1; @@ -1497,7 +1497,7 @@ static void _PlayerFootStep(const vector3 *origin, const float orientation, cons CG_ImpactMark(footMarkShader, &trace.endpos, &trace.plane.normal, orientation, 1, 1, 1, 1.0f, qfalse, radius, qfalse); } -static void CG_PlayerFootsteps(centity_t *cent, footstepType_t footStepType) { +static void CG_PlayerFootsteps(centity_t *cent, footstepType_e footStepType) { if (!cg_footsteps.integer) return; @@ -1547,6 +1547,7 @@ void CG_PlayerAnimEventDo(centity_t *cent, animevent_t *animEvent) { switch (animEvent->eventType) { case AEV_SOUNDCHAN: channel = (soundChannel_t)animEvent->eventData[AED_SOUNDCHANNEL]; + [[fallthrough]]; case AEV_SOUND: { // are there variations on the sound? const int holdSnd = animEvent->eventData[AED_SOUNDINDEX_START + Q_irand(0, animEvent->eventData[AED_SOUND_NUMRANDOMSNDS])]; @@ -1624,7 +1625,7 @@ void CG_PlayerAnimEventDo(centity_t *cent, animevent_t *animEvent) { break; case AEV_FOOTSTEP: - CG_PlayerFootsteps(cent, (footstepType_t)animEvent->eventData[AED_FOOTSTEP_TYPE]); + CG_PlayerFootsteps(cent, (footstepType_e)animEvent->eventData[AED_FOOTSTEP_TYPE]); break; case AEV_EFFECT: @@ -6234,7 +6235,7 @@ static void CG_VehicleEffects(centity_t *cent) { #else if (pVehNPC->m_pVehicleInfo->iTrailFX) #endif - trap->FX_PlayEffectID(pVehNPC->m_pVehicleInfo->iTrailFX, &org, &fwd, -1, -1, qfalse); + { trap->FX_PlayEffectID(pVehNPC->m_pVehicleInfo->iTrailFX, &org, &fwd, -1, -1, qfalse); } // do exhaust if ((cent->currentState.eFlags & EF_JETPACK_ACTIVE)) @@ -6919,7 +6920,7 @@ void CG_Player(centity_t *cent) { VectorCopy(&seeker.origin, &seekorg); if (cent->currentState.genericenemyindex > MAX_GENTITIES) { - float prefig = (cent->currentState.genericenemyindex - cg.time) / 80; + float prefig = (cent->currentState.genericenemyindex - cg.time) / 80.0f; if (prefig > 55) prefig = 55; @@ -8315,7 +8316,7 @@ void CG_Player(centity_t *cent) { legs.shaderRGBA[0] = 255; legs.shaderRGBA[1] = 255; legs.shaderRGBA[2] = 255; - legs.shaderRGBA[3] = 10.0f + (sinf((float)(cg.time / 4)) * 128.0f); + legs.shaderRGBA[3] = 10.0f + (sinf((float)(cg.time / 4.0f)) * 128.0f); legs.renderfx &= ~RF_RGB_TINT; legs.renderfx &= ~RF_FORCE_ENT_ALPHA; @@ -8601,5 +8602,5 @@ void CG_ResetPlayerEntity(centity_t *cent) { } if (cg_debugPosition.integer) - trap->Print("%i ResetPlayerEntity yaw=%.2f\n", cent->currentState.number, cent->pe.torso.yawAngle); + trap->Print("%i ResetPlayerEntity yaw=%.2f\n", cent->currentState.number, (double)cent->pe.torso.yawAngle); } diff --git a/cgame/cg_predict.cpp b/cgame/cg_predict.cpp index 6c90418..ef21793 100644 --- a/cgame/cg_predict.cpp +++ b/cgame/cg_predict.cpp @@ -772,7 +772,7 @@ void CG_PredictPlayerState(void) { len = VectorLength(&delta); if (len > 0.1f) { if (cg_showVehMiss.integer) - trap->Print("VEH Prediction miss: %f\n", len); + trap->Print("VEH Prediction miss: %f\n", (double)len); if (cg_errorDecay.integer) { int t; float f; @@ -782,7 +782,7 @@ void CG_PredictPlayerState(void) { if (f < 0) f = 0; if (f > 0 && cg_showVehMiss.integer) - trap->Print("VEH Double prediction decay: %f\n", f); + trap->Print("VEH Double prediction decay: %f\n", (double)f); VectorScale(&cg.predictedError, f, &cg.predictedError); } else VectorClear(&cg.predictedError); @@ -794,11 +794,11 @@ void CG_PredictPlayerState(void) { if (!VectorCompare(&oldVehicleState.vehOrientation, &cg.predictedVehicleState.vehOrientation)) { trap->Print("VEH orient prediction error\n"); trap->Print("VEH pitch prediction miss: %f\n", - AngleSubtract(oldVehicleState.vehOrientation.x, cg.predictedVehicleState.vehOrientation.x)); + (double)AngleSubtract(oldVehicleState.vehOrientation.x, cg.predictedVehicleState.vehOrientation.x)); trap->Print("VEH yaw prediction miss: %f\n", - AngleSubtract(oldVehicleState.vehOrientation.y, cg.predictedVehicleState.vehOrientation.y)); + (double)AngleSubtract(oldVehicleState.vehOrientation.y, cg.predictedVehicleState.vehOrientation.y)); trap->Print("VEH roll prediction miss: %f\n", - AngleSubtract(oldVehicleState.vehOrientation.z, cg.predictedVehicleState.vehOrientation.z)); + (double)AngleSubtract(oldVehicleState.vehOrientation.z, cg.predictedVehicleState.vehOrientation.z)); } } } @@ -822,7 +822,7 @@ void CG_PredictPlayerState(void) { len = VectorLength(&delta); if (len > 0.1f) { if (cg_showMiss.integer) - trap->Print("Prediction miss: %f\n", len); + trap->Print("Prediction miss: %f\n", (double)len); if (cg_errorDecay.integer) { int t; float f; @@ -832,7 +832,7 @@ void CG_PredictPlayerState(void) { if (f < 0) f = 0; if (f > 0 && cg_showMiss.integer) - trap->Print("Double prediction decay: %f\n", f); + trap->Print("Double prediction decay: %f\n", (double)f); VectorScale(&cg.predictedError, f, &cg.predictedError); } else VectorClear(&cg.predictedError); diff --git a/cgame/cg_public.h b/cgame/cg_public.h index 8c6ab82..881d0b6 100644 --- a/cgame/cg_public.h +++ b/cgame/cg_public.h @@ -36,7 +36,7 @@ typedef struct snapshot_s { int serverCommandSequence; // snapshot becomes current } snapshot_t; -typedef enum cgameEvent_e { CGAME_EVENT_NONE = 0, CGAME_EVENT_TEAMMENU, CGAME_EVENT_SCOREBOARD, CGAME_EVENT_EDITHUD } cgameEvent_t; +enum cgameEvent_e { CGAME_EVENT_NONE = 0, CGAME_EVENT_TEAMMENU, CGAME_EVENT_SCOREBOARD, CGAME_EVENT_EDITHUD }; typedef struct autoMapInput_s { float up; @@ -174,7 +174,7 @@ typedef struct ragCallbackTraceLine_s { #define MAX_CG_SHARED_BUFFER_SIZE 2048 -typedef enum cgameImportLegacy_e { +enum cgameImportLegacy_e { CG_PRINT = 0, CG_ERROR, CG_MILLISECONDS, @@ -410,9 +410,9 @@ typedef enum cgameImportLegacy_e { CG_R_WEATHER_CONTENTS_OVERRIDE, CG_R_WORLDEFFECTCOMMAND, CG_WE_ADDWEATHERZONE -} cgameImportLegacy_t; +}; -typedef enum cgameExportLegacy_e { +enum cgameExportLegacy_e { CG_INIT, CG_SHUTDOWN, CG_CONSOLE_COMMAND, @@ -445,7 +445,7 @@ typedef enum cgameExportLegacy_e { CG_MISC_ENT, CG_GET_SORTED_FORCE_POWER, CG_FX_CAMERASHAKE, -} cgameExportLegacy_t; +}; typedef struct cgameImport_s { // common @@ -713,7 +713,7 @@ typedef struct cgameExport_s { void (*Init)(int serverMessageNum, int serverCommandSequence, int clientNum, qboolean demoPlayback); void (*Shutdown)(void); qboolean (*ConsoleCommand)(void); - void (*DrawActiveFrame)(int serverTime, stereoFrame_t stereoView, qboolean demoPlayback); + void (*DrawActiveFrame)(int serverTime, stereoFrame_e stereoView, qboolean demoPlayback); int (*CrosshairPlayer)(void); int (*LastAttacker)(void); void (*KeyEvent)(int key, qboolean down); diff --git a/cgame/cg_q3pScoreboard.cpp b/cgame/cg_q3pScoreboard.cpp index 3be9b13..643600a 100644 --- a/cgame/cg_q3pScoreboard.cpp +++ b/cgame/cg_q3pScoreboard.cpp @@ -66,7 +66,7 @@ static void DrawServerInfo(float fade) { fontLarge.Paint(SCREEN_WIDTH / 2.0f - fontLarge.Width(tmp), y, tmp, &colour, uiTextStyle_e::Shadowed); y += lineHeightBig * 2; - // FALL THROUGH TO GENERIC TEAM GAME INFO! + [[fallthrough]]; // to generic team game info case GT_TEAM: if (cgs.scores1 == cgs.scores2) { @@ -205,7 +205,7 @@ static void DrawPlayerCount(float fade) { } // number of players on team 'team' -static int PlayerCount(team_t team) { +static int PlayerCount(team_e team) { int i, count = 0; for (i = 0; i < cg.numScores; i++) { @@ -351,7 +351,7 @@ static int ListPlayers_FFA(float fade, float x, float y, float fontScale, int fo } // returns number of players on team 'team' -static int ListPlayers_TDM(float fade, float x, float y, float fontScale, int fontHandle, team_t team) { +static int ListPlayers_TDM(float fade, float x, float y, float fontScale, int fontHandle, team_e team) { const char *tmp = NULL; vector4 white = {1.0f, 1.0f, 1.0f, 1.0f}, blue = {0.6f, 0.6f, 1.0f, 1.0f}, background = {0.75f, 0.75f, 0.75f, 1.0f}, teamRed = {0.7f, 0.4f, 0.4f, 1.0f}, teamBlue = {0.4f, 0.4f, 0.7f, 1.0f}; @@ -489,7 +489,7 @@ static int ListPlayers_TDM(float fade, float x, float y, float fontScale, int fo } // returns number of players on team 'team' -static int ListPlayers_CTF(float fade, float x, float y, float fontScale, int fontHandle, team_t team) { +static int ListPlayers_CTF(float fade, float x, float y, float fontScale, int fontHandle, team_e team) { const char *tmp = NULL; vector4 white = {1.0f, 1.0f, 1.0f, 1.0f}, blue = {0.6f, 0.6f, 1.0f, 1.0f}, background = {0.75f, 0.75f, 0.75f, 1.0f}, teamRed = {0.7f, 0.4f, 0.4f, 1.0f}, teamBlue = {0.4f, 0.4f, 0.7f, 1.0f}; @@ -668,7 +668,7 @@ static int ListPlayers_Free(float fade, float x, float y, float fontScale, int f } // render a list of players on team 'team' at 'x', 'y' using relevant information based on gametype -static int ListPlayers_Team(float fade, float x, float y, float fontScale, int fontHandle, float lineHeight, team_t team) { +static int ListPlayers_Team(float fade, float x, float y, float fontScale, int fontHandle, float lineHeight, team_e team) { switch (cgs.gametype) { case GT_FFA: case GT_HOLOCRON: diff --git a/cgame/cg_scoreboard.cpp b/cgame/cg_scoreboard.cpp index 34b4831..22c7780 100644 --- a/cgame/cg_scoreboard.cpp +++ b/cgame/cg_scoreboard.cpp @@ -189,7 +189,7 @@ static void CG_DrawClientScore(int y, score_t *score, const vector4 *color, floa } } -static int CG_TeamScoreboard(int y, team_t team, float fade, int maxClients, int lineHeight, qboolean countOnly) { +static int CG_TeamScoreboard(int y, team_e team, float fade, int maxClients, int lineHeight, qboolean countOnly) { int i; score_t *score; vector4 color; @@ -216,7 +216,7 @@ static int CG_TeamScoreboard(int y, team_t team, float fade, int maxClients, int return count; } -int CG_GetClassCount(team_t team, int siegeClass) { +int CG_GetClassCount(team_e team, int siegeClass) { int i = 0; int count = 0; clientInfo_t *ci; @@ -240,7 +240,7 @@ int CG_GetClassCount(team_t team, int siegeClass) { return count; } -int CG_GetTeamNonScoreCount(team_t team) { +int CG_GetTeamNonScoreCount(team_e team) { int i = 0, count = 0; clientInfo_t *ci; @@ -256,7 +256,7 @@ int CG_GetTeamNonScoreCount(team_t team) { return count; } -int CG_GetTeamCount(team_t team, int maxClients) { +int CG_GetTeamCount(team_e team, int maxClients) { int i = 0; int count = 0; clientInfo_t *ci; diff --git a/cgame/cg_servercmds.cpp b/cgame/cg_servercmds.cpp index d38004e..a394544 100644 --- a/cgame/cg_servercmds.cpp +++ b/cgame/cg_servercmds.cpp @@ -92,7 +92,7 @@ void CG_ParseServerinfo(void) { cgs.dmflags = atoi(Info_ValueForKey(info, "dmflags")); cgs.duel_fraglimit = atoi(Info_ValueForKey(info, "duel_fraglimit")); cgs.capturelimit = atoi(Info_ValueForKey(info, "capturelimit")); - cgs.gametype = (gametype_t)atoi(Info_ValueForKey(info, "g_gametype")); + cgs.gametype = (gametype_e)atoi(Info_ValueForKey(info, "g_gametype")); cgs.japp.jp_cinfo = atoi(Info_ValueForKey(info, "jp_cinfo")); cgs.japp.overbounce = atoi(Info_ValueForKey(info, "pmove_overbounce")); fraglimit = atoi(Info_ValueForKey(info, "fraglimit")); diff --git a/cgame/cg_view.cpp b/cgame/cg_view.cpp index 9fb226e..51ce6df 100644 --- a/cgame/cg_view.cpp +++ b/cgame/cg_view.cpp @@ -1,8 +1,8 @@ -#include "cg_local.h" -#include "bg_saga.h" -#include "cg_lights.h" -#include "bg_luaevent.h" -#include "cg_media.h" +#include "cgame/cg_local.h" +#include "game/bg_saga.h" +#include "cgame/cg_lights.h" +#include "game/bg_luaevent.h" +#include "cgame/cg_media.h" uint32_t CG_GetCameraClip(void) { return (cg.japp.isGhosted) ? (MASK_SOLID) : (MASK_SOLID | CONTENTS_PLAYERCLIP); } @@ -1443,7 +1443,7 @@ void CG_SE_UpdateMusic(void) { if (cgScreenEffects.music_volume_multiplier > 1.0f) cgScreenEffects.music_volume_multiplier = 1.0f; - Com_sprintf(musMultStr, sizeof(musMultStr), "%f", cgScreenEffects.music_volume_multiplier); + Com_sprintf(musMultStr, sizeof(musMultStr), "%f", (double)cgScreenEffects.music_volume_multiplier); trap->Cvar_Set("s_musicMult", musMultStr); if (cgScreenEffects.music_volume_multiplier == 1.0f) @@ -1459,7 +1459,7 @@ void CG_SE_UpdateMusic(void) { // if the volume_time is >= cg.time, we should have a volume multiplier set char musMultStr[512]; - Com_sprintf(musMultStr, sizeof(musMultStr), "%f", cgScreenEffects.music_volume_multiplier); + Com_sprintf(musMultStr, sizeof(musMultStr), "%f", (double)cgScreenEffects.music_volume_multiplier); trap->Cvar_Set("s_musicMult", musMultStr); cgScreenEffects.music_volume_set = qtrue; } @@ -1632,8 +1632,8 @@ void CG_DrawAutoMap(void) { trap->R_GetRealRes(&vWidth, &vHeight); // set scaling values so that the 640x480 will result at 1.0f/1.0f - hScale = vWidth / SCREEN_WIDTH; - vScale = vHeight / SCREEN_HEIGHT; + hScale = vWidth / (float)SCREEN_WIDTH; + vScale = vHeight / (float)SCREEN_HEIGHT; x = r_autoMapX.value; y = r_autoMapY.value; @@ -1813,7 +1813,7 @@ static void addVelocityVector(void) { // dynamic settings VectorCopy(&cg.predictedPlayerState.origin, &ref->origin); - ref->origin.z += cg.predictedPlayerState.viewheight / 2; + ref->origin.z += cg.predictedPlayerState.viewheight / 2.0f; VectorCopy(&cg.predictedPlayerState.velocity, &velocity); velocity.z = 0; @@ -1887,8 +1887,8 @@ static qboolean addIdealVectors(void) { VectorCopy(&cg.predictedPlayerState.origin, &right->origin); // move both vectors up a bit (dont wanna have it on ground) - left->origin.z += cg.predictedPlayerState.viewheight / 2; - right->origin.z += cg.predictedPlayerState.viewheight / 2; + left->origin.z += cg.predictedPlayerState.viewheight / 2.0f; + right->origin.z += cg.predictedPlayerState.viewheight / 2.0f; // ends of the ideal vectors left->oldorigin.z = right->oldorigin.z = 0; @@ -1986,7 +1986,7 @@ void CG_AddMovementVectors(void) { } // Generates and draws a game scene and status information at the given time. -void CG_DrawActiveFrame(int serverTime, stereoFrame_t stereoView, qboolean demoPlayback) { +void CG_DrawActiveFrame(int serverTime, stereoFrame_e stereoView, qboolean demoPlayback) { int inwater; const char *cstr; float mSensitivity = cg.zoomSensitivity, mPitchOverride = 0.0f, mYawOverride = 0.0f; @@ -2251,7 +2251,7 @@ void CG_DrawActiveFrame(int serverTime, stereoFrame_t stereoView, qboolean demoP timescale.value = cg_timescaleFadeEnd.value; } if (cg_timescaleFadeSpeed.value) - trap->Cvar_Set("timescale", va("%f", timescale.value)); + trap->Cvar_Set("timescale", va("%f", (double)timescale.value)); } // Raz: JPLua diff --git a/cgame/cg_weapons.cpp b/cgame/cg_weapons.cpp index ae653c5..2bde263 100644 --- a/cgame/cg_weapons.cpp +++ b/cgame/cg_weapons.cpp @@ -215,14 +215,14 @@ static void CG_AddWeaponWithPowerups(refEntity_t *gun, int powerups) { void CG_AddPlayerWeapon(refEntity_t *parent, playerState_t *ps, centity_t *cent, int team, vector3 *newAngles, qboolean thirdPerson) { refEntity_t gun, barrel, flash; vector3 angles; - weapon_t weaponNum; + weapon_e weaponNum; weaponInfo_t *weapon; centity_t *nonPredictedCent; if (!thirdPerson && cg_fakeGun.integer) { - weaponNum = (weapon_t)cg_fakeGun.integer; + weaponNum = (weapon_e)cg_fakeGun.integer; } else { - weaponNum = (weapon_t)cent->currentState.weapon; + weaponNum = (weapon_e)cent->currentState.weapon; } if (weaponNum == WP_EMPLACED_GUN) @@ -1226,7 +1226,7 @@ qboolean CG_VehicleWeaponImpact(centity_t *cent) { } // Caused by an EV_MISSILE_MISS event, or directly by local bullet tracing -void CG_MissileHitWall(int weapon, int clientNum, vector3 *origin, vector3 *dir, impactSound_t soundType, qboolean altFire, int charge) { +void CG_MissileHitWall(int weapon, int clientNum, vector3 *origin, vector3 *dir, impactSound_e soundType, qboolean altFire, int charge) { int parm; static const vector3 up = {0, 0, 1}; diff --git a/cgame/tr_types.h b/cgame/tr_types.h index ca821f3..56794de 100644 --- a/cgame/tr_types.h +++ b/cgame/tr_types.h @@ -58,7 +58,7 @@ typedef struct poly_s { polyVert_t *verts; } poly_t; -typedef enum refEntityType_e { +enum refEntityType_e { RT_MODEL, RT_POLY, RT_SPRITE, @@ -73,10 +73,10 @@ typedef enum refEntityType_e { RT_ENT_CHAIN, RT_MAX_REF_ENTITY_TYPE -} refEntityType_t; +}; typedef struct miniRefEntity_s { - refEntityType_t reType; + refEntityType_e reType; int renderfx; qhandle_t hModel; // opaque type outside refresh @@ -113,7 +113,7 @@ typedef struct refEntity_s { // this stucture must remain identical as the miniRefEntity_t // // - refEntityType_t reType; + refEntityType_e reType; int renderfx; qhandle_t hModel; // opaque type outside refresh @@ -243,7 +243,7 @@ typedef struct refdef_s { char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH]; } refdef_t; -typedef enum stereoFrame_e { STEREO_CENTER, STEREO_LEFT, STEREO_RIGHT } stereoFrame_t; +enum stereoFrame_e { STEREO_CENTER, STEREO_LEFT, STEREO_RIGHT }; /* ** glconfig_t @@ -252,7 +252,7 @@ typedef enum stereoFrame_e { STEREO_CENTER, STEREO_LEFT, STEREO_RIGHT } stereoFr ** being run right now. These are constant once the OpenGL ** subsystem is initialized. */ -typedef enum textureCompression_e { TC_NONE, TC_S3TC, TC_S3TC_DXT } textureCompression_t; +enum textureCompression_e { TC_NONE, TC_S3TC, TC_S3TC_DXT }; typedef struct glconfig_s { const char *renderer_string; @@ -267,7 +267,7 @@ typedef struct glconfig_s { int colorBits, depthBits, stencilBits; qboolean deviceSupportsGamma; - textureCompression_t textureCompression; + textureCompression_e textureCompression; qboolean textureEnvAddAvailable; qboolean clampToEdgeAvailable; diff --git a/game/AnimalNPC.cpp b/game/AnimalNPC.cpp index c171c38..e6a55c8 100644 --- a/game/AnimalNPC.cpp +++ b/game/AnimalNPC.cpp @@ -14,7 +14,7 @@ extern vector3 playerMins; extern vector3 playerMaxs; void PM_SetAnim(pmove_t *pm, int setAnimParts, int anim, uint32_t setAnimFlags, int blendTime); -int PM_AnimLength(int index, animNumber_t anim); +int PM_AnimLength(int index, animNumber_e anim); void Vehicle_SetAnim(gentity_t *ent, int setAnimParts, int anim, uint32_t setAnimFlags, int iBlend); void G_VehicleTrace(trace_t *results, const vector3 *start, const vector3 *tMins, const vector3 *tMaxs, const vector3 *end, int passEntityNum, int contentmask); @@ -274,7 +274,7 @@ void AnimalProcessOri(Vehicle_t *pVeh) { ProcessOrientCommands(pVeh); } #ifdef PROJECT_GAME // back to our game-only functions static void AnimateVehicle(Vehicle_t *pVeh) { - animNumber_t Anim = BOTH_VT_IDLE; + animNumber_e Anim = BOTH_VT_IDLE; int iFlags = SETANIM_FLAG_NORMAL, iBlend = 300; gentity_t *pilot = (gentity_t *)pVeh->m_pPilot; gentity_t *parent = (gentity_t *)pVeh->m_pParentEntity; @@ -377,7 +377,7 @@ static void AnimateVehicle(Vehicle_t *pVeh) { // and lagged // This function makes sure that the rider's in this vehicle are properly animated. static void AnimateRiders(Vehicle_t *pVeh) { - animNumber_t Anim = BOTH_VT_IDLE; + animNumber_e Anim = BOTH_VT_IDLE; int iFlags = SETANIM_FLAG_NORMAL, iBlend = 500; gentity_t *pilot = (gentity_t *)pVeh->m_pPilot; gentity_t *parent = (gentity_t *)pVeh->m_pParentEntity; @@ -408,7 +408,7 @@ static void AnimateRiders(Vehicle_t *pVeh) { qboolean Turbo = (fSpeedPercToMax > 0.0f && level.time < pVeh->m_iTurboTime); qboolean Walking = (fSpeedPercToMax > 0.0f && ((pVeh->m_ucmd.buttons & BUTTON_WALKING) || fSpeedPercToMax <= 0.275f)); qboolean Running = (fSpeedPercToMax > 0.275f); - EWeaponPose WeaponPose = WPOSE_NONE; + weaponPose_e WeaponPose = WPOSE_NONE; // Remove Crashing Flag pVeh->m_ulFlags &= ~VEH_CRASHING; diff --git a/game/FighterNPC.cpp b/game/FighterNPC.cpp index d02a5c7..4ed1ba6 100644 --- a/game/FighterNPC.cpp +++ b/game/FighterNPC.cpp @@ -17,7 +17,7 @@ extern vector3 playerMins; extern vector3 playerMaxs; void ChangeWeapon(gentity_t *ent, int newWeapon); void PM_SetAnim(pmove_t *pm, int setAnimParts, int anim, uint32_t setAnimFlags, int blendTime); -int PM_AnimLength(int index, animNumber_t anim); +int PM_AnimLength(int index, animNumber_e anim); void G_VehicleTrace(trace_t *results, const vector3 *start, const vector3 *tMins, const vector3 *tMaxs, const vector3 *end, int passEntityNum, int contentmask); #endif @@ -216,7 +216,7 @@ qboolean FighterIsLaunching(Vehicle_t *pVeh, playerState_t *parentPS) { qboolean FighterSuspended(Vehicle_t *pVeh, playerState_t *parentPS) { #if defined(PROJECT_GAME) // only do this check on game side, because if it's cgame, it's being predicted, and it's only predicted if the local client is the // driver - if (!pVeh->m_pPilot // empty + if (!pVeh->m_pPilot // empty && !(int)parentPS->speed // not moving && pVeh->m_ucmd.forwardmove <= 0 // not trying to go forward for whatever reason && pVeh->m_pParentEntity != NULL && (((gentity_t *)pVeh->m_pParentEntity)->spawnflags & 2)) // SUSPENDED spawnflag is on @@ -260,8 +260,8 @@ static void ProcessMoveCommands(Vehicle_t *pVeh) { parentPS->speed = 0.0f; } else { if (parentPS->speed < HYPERSPACE_SPEED) { // just started hyperspace - // MIKE: This is going to play the sound twice for the predicting client, I suggest using - // a predicted event or only doing it game-side. -rich + // MIKE: This is going to play the sound twice for the predicting client, I suggest using + // a predicted event or only doing it game-side. -rich #if defined(PROJECT_GAME) // G_EntitySound( ((gentity_t *)(pVeh->m_pParentEntity)), CHAN_LOCAL, pVeh->m_pVehicleInfo->soundHyper ); #elif defined(PROJECT_CGAME) diff --git a/game/NPC.cpp b/game/NPC.cpp index 823a936..c46a9e1 100644 --- a/game/NPC.cpp +++ b/game/NPC.cpp @@ -3,7 +3,6 @@ // #include "b_local.h" #include "anims.h" -#include "say.h" #include "ICARUS/Q3_Interface.h" extern vector3 playerMins; @@ -30,7 +29,7 @@ gentity_t *NPC; gNPC_t *NPCInfo; gclient_t *client; usercmd_t ucmd; -visibility_t enemyVisibility; +visibility_e enemyVisibility; void pitch_roll_for_slope(gentity_t *forwhom, vector3 *pass_slope); void GM_Dying(gentity_t *self); @@ -443,7 +442,7 @@ static void DeadThink(void) { NPC->nextthink = level.time + FRAMETIME; } } else { - class_t npc_class; + class_e npc_class; // Start the body effect first, then delay 400ms before ditching the corpse NPC_RemoveBodyEffect(); @@ -532,6 +531,7 @@ void NPC_ShowDebugInfo(void) { vector3 mins, maxs; while ((found = G_Find(found, FOFS(classname), "NPC")) != NULL) { + // FIXME: clientNum 0? if (trap->InPVS(&found->r.currentOrigin, &g_entities[0].r.currentOrigin)) { VectorAdd(&found->r.currentOrigin, &found->r.mins, &mins); VectorAdd(&found->r.currentOrigin, &found->r.maxs, &maxs); @@ -1196,7 +1196,7 @@ void NPC_RunBehavior(int team, int bState) { // NPC Behavior state thinking void NPC_ExecuteBState(gentity_t *self) //, int msec ) { - bState_t bState; + bState_e bState; NPC_HandleAIFlags(); diff --git a/game/NPC_AI_Default.cpp b/game/NPC_AI_Default.cpp index 50fb907..fbe7f60 100644 --- a/game/NPC_AI_Default.cpp +++ b/game/NPC_AI_Default.cpp @@ -58,7 +58,7 @@ void NPC_StandIdle(void) { //Start that animation going NPC_SetAnim( NPC, SETANIM_BOTH, baseSeq + newIdle, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); - int newTime = PM_AnimLength( NPC->client->clientInfo.animFileIndex, (animNumber_t) (baseSeq + newIdle) ); + int newTime = PM_AnimLength( NPC->client->clientInfo.animFileIndex, (animNumber_e) (baseSeq + newIdle) ); //Don't do this again for a random amount of time TIMER_Set( NPC, "idleAnim", newTime + Q_irand( 2000, 10000 ) ); @@ -166,7 +166,7 @@ void NPC_BSHuntAndKill(void) { qboolean turned = qfalse; vector3 vec; float enemyDist; - visibility_t oEVis; + visibility_e oEVis; int curAnim; NPC_CheckEnemy(NPCInfo->tempBehavior != BS_HUNT_AND_KILL, qfalse, qtrue); // don't find new enemy if this is tempbehav diff --git a/game/NPC_AI_Droid.cpp b/game/NPC_AI_Droid.cpp index 6a932df..6d44fd5 100644 --- a/game/NPC_AI_Droid.cpp +++ b/game/NPC_AI_Droid.cpp @@ -3,7 +3,7 @@ #define TURN_OFF 0x00000100 // Local state enums -enum { LSTATE_NONE = 0, LSTATE_BACKINGUP, LSTATE_SPINNING, LSTATE_PAIN, LSTATE_DROP }; +enum localState_e { LSTATE_NONE = 0, LSTATE_BACKINGUP, LSTATE_SPINNING, LSTATE_PAIN, LSTATE_DROP }; void R2D2_PartsMove(void) { // Front 'eye' lense diff --git a/game/NPC_AI_GalakMech.cpp b/game/NPC_AI_GalakMech.cpp index 729b740..f29ed6a 100644 --- a/game/NPC_AI_GalakMech.cpp +++ b/game/NPC_AI_GalakMech.cpp @@ -979,17 +979,17 @@ void NPC_BSGM_Attack(void) { #endif } - if (NPCInfo->movementSpeech < 3 && NPCInfo->blockedSpeechDebounceTime <= level.time) { + if (NPCInfo->movementSpeech < SPEECH_DETECTED && NPCInfo->blockedSpeechDebounceTime <= level.time) { if (NPC->enemy && NPC->enemy->health > 0 && NPC->enemy->painDebounceTime > level.time) { - if (NPC->enemy->health < 50 && NPCInfo->movementSpeech == 2) { + if (NPC->enemy->health < 50 && NPCInfo->movementSpeech == SPEECH_COVER) { G_AddVoiceEvent(NPC, EV_ANGER2, Q_irand(2000, 4000)); - NPCInfo->movementSpeech = 3; - } else if (NPC->enemy->health < 75 && NPCInfo->movementSpeech == 1) { + NPCInfo->movementSpeech = SPEECH_DETECTED; + } else if (NPC->enemy->health < 75 && NPCInfo->movementSpeech == SPEECH_CONFUSED) { G_AddVoiceEvent(NPC, EV_ANGER1, Q_irand(2000, 4000)); - NPCInfo->movementSpeech = 2; - } else if (NPC->enemy->health < 100 && NPCInfo->movementSpeech == 0) { + NPCInfo->movementSpeech = SPEECH_COVER; + } else if (NPC->enemy->health < 100 && NPCInfo->movementSpeech == SPEECH_CHASE) { G_AddVoiceEvent(NPC, EV_ANGER3, Q_irand(2000, 4000)); - NPCInfo->movementSpeech = 1; + NPCInfo->movementSpeech = SPEECH_CONFUSED; } } } diff --git a/game/NPC_AI_Grenadier.cpp b/game/NPC_AI_Grenadier.cpp index 36dcccc..7c1de38 100644 --- a/game/NPC_AI_Grenadier.cpp +++ b/game/NPC_AI_Grenadier.cpp @@ -31,7 +31,7 @@ static qboolean shoot3; static float enemyDist3; // Local state enums -enum { +enum localState_e { LSTATE_NONE = 0, LSTATE_UNDERFIRE, LSTATE_INVESTIGATE, diff --git a/game/NPC_AI_Howler.cpp b/game/NPC_AI_Howler.cpp index 202f5ef..89e013a 100644 --- a/game/NPC_AI_Howler.cpp +++ b/game/NPC_AI_Howler.cpp @@ -29,7 +29,7 @@ void Howler_Patrol(void) { } } - // rwwFIXMEFIXME: Care about all clients, not just client 0 + // FIXME: clientNum 0 VectorSubtract(&g_entities[0].r.currentOrigin, &NPC->r.currentOrigin, &dif); if (VectorLengthSquared(&dif) < 256 * 256) { diff --git a/game/NPC_AI_ImperialProbe.cpp b/game/NPC_AI_ImperialProbe.cpp index 830a50e..910949db 100644 --- a/game/NPC_AI_ImperialProbe.cpp +++ b/game/NPC_AI_ImperialProbe.cpp @@ -2,7 +2,7 @@ #include "g_nav.h" // Local state enums -enum { LSTATE_NONE = 0, LSTATE_BACKINGUP, LSTATE_SPINNING, LSTATE_PAIN, LSTATE_DROP }; +enum localState_t { LSTATE_NONE = 0, LSTATE_BACKINGUP, LSTATE_SPINNING, LSTATE_PAIN, LSTATE_DROP }; void ImperialProbe_Idle(void); diff --git a/game/NPC_AI_Interrogator.cpp b/game/NPC_AI_Interrogator.cpp index f2f44c7..bcc0b16 100644 --- a/game/NPC_AI_Interrogator.cpp +++ b/game/NPC_AI_Interrogator.cpp @@ -4,11 +4,7 @@ void Interrogator_Idle(void); void DeathFX(gentity_t *ent); -enum { - LSTATE_BLADESTOP = 0, - LSTATE_BLADEUP, - LSTATE_BLADEDOWN, -}; +enum localState_e { LSTATE_BLADESTOP = 0, LSTATE_BLADEUP, LSTATE_BLADEDOWN }; void NPC_Interrogator_Precache(void) { G_SoundIndex("sound/chars/interrogator/misc/torture_droid_lp"); @@ -58,7 +54,7 @@ void Interrogator_PartsMove(void) { } // gi.G2API_SetBoneAnglesIndex( &NPC->ghoul2[NPC->playerModel], NPC->genericBone1, NPC->pos1, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, - //NEGATIVE_Z, NULL ); + // NEGATIVE_Z, NULL ); NPC_SetBoneAngles(NPC, "left_arm", &NPC->pos1); TIMER_Set(NPC, "syringeDelay", Q_irand(100, 1000)); @@ -86,7 +82,7 @@ void Interrogator_PartsMove(void) { NPC->pos2.x = AngleNormalize360(NPC->pos2.x); // gi.G2API_SetBoneAnglesIndex( &NPC->ghoul2[NPC->playerModel], NPC->genericBone2, NPC->pos2, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, - //NEGATIVE_Z, NULL ); + // NEGATIVE_Z, NULL ); NPC_SetBoneAngles(NPC, "right_arm", &NPC->pos2); } diff --git a/game/NPC_AI_Jedi.cpp b/game/NPC_AI_Jedi.cpp index e0d93c9..1f0ea22 100644 --- a/game/NPC_AI_Jedi.cpp +++ b/game/NPC_AI_Jedi.cpp @@ -56,11 +56,7 @@ extern int bg_parryDebounce[]; static int jediSpeechDebounceTime[TEAM_NUM_TEAMS]; // used to stop several jedi from speaking all at once // Local state enums -enum { - LSTATE_NONE = 0, - LSTATE_UNDERFIRE, - LSTATE_INVESTIGATE, -}; +enum localState_e { LSTATE_NONE = 0, LSTATE_UNDERFIRE, LSTATE_INVESTIGATE }; void NPC_ShadowTrooper_Precache(void) { RegisterItem(BG_FindItemForAmmo(AMMO_FORCE)); @@ -1480,7 +1476,7 @@ FIXME: possibly let player do this too? // rwwFIXMEFIXME: Going to use qboolean Jedi_DodgeEvasion( gentity_t *self, gentity_t *shooter, trace_t *tr, int hitLoc ) from // w_saber.c.. maybe use seperate one for NPCs or add cases to that one? -evasionType_t Jedi_CheckFlipEvasions(gentity_t *self, float rightdot, float zdiff) { +evasionType_e Jedi_CheckFlipEvasions(gentity_t *self, float rightdot, float zdiff) { if (self->NPC && (self->NPC->scriptFlags & SCF_NO_ACROBATICS)) { return EVASION_NONE; } @@ -1502,7 +1498,7 @@ evasionType_t Jedi_CheckFlipEvasions(gentity_t *self, float rightdot, float zdif AngleVectors(&fwdAngles, NULL, &right, NULL); - animLength = BG_AnimLength(self->localAnimIndex, (animNumber_t)self->client->ps.legsAnim); + animLength = BG_AnimLength(self->localAnimIndex, (animNumber_e)self->client->ps.legsAnim); if (self->client->ps.legsAnim == BOTH_WALL_RUN_LEFT && rightdot < 0) { // I'm running on a wall to my left and the attack is on the left if (animLength - self->client->ps.legsTimer > 400 && self->client->ps.legsTimer > 400) { // not at the beginning or end of the anim anim = BOTH_WALL_RUN_LEFT_FLIP; @@ -1722,7 +1718,7 @@ evasionType_t Jedi_CheckFlipEvasions(gentity_t *self, float rightdot, float zdif return EVASION_NONE; } -int Jedi_ReCalcParryTime(gentity_t *self, evasionType_t evasionType) { +int Jedi_ReCalcParryTime(gentity_t *self, evasionType_e evasionType) { if (!self->client) { return 0; } @@ -1835,14 +1831,14 @@ qboolean G_FindClosestPointOnLineSegment(const vector3 *start, const vector3 *en // Pick proper block anim // FIXME: Based on difficulty level/enemy saber combat skill, make this decision-making more/less effective // NOTE: always blocking projectiles in this func! -evasionType_t Jedi_SaberBlockGo(gentity_t *self, usercmd_t *cmd, vector3 *pHitloc, vector3 *phitDir, gentity_t *incoming, float dist) { +evasionType_e Jedi_SaberBlockGo(gentity_t *self, usercmd_t *cmd, vector3 *pHitloc, vector3 *phitDir, gentity_t *incoming, float dist) { vector3 hitloc, hitdir, diff, fwdangles = {0, 0, 0}, right; float rightdot; float zdiff; int duckChance = 0; int dodgeAnim = -1; qboolean saberBusy = qfalse, doDodge = qfalse; - evasionType_t evasionType = EVASION_NONE; + evasionType_e evasionType = EVASION_NONE; // FIXME: if we don't have our saber in hand, pick the force throw option or a jump or strafe! // FIXME: reborn don't block enough anymore @@ -2285,7 +2281,7 @@ static qboolean Jedi_SaberBlock(int saberNum, int bladeNum) // saberNum = 0, bla float pointDist, baseDirPerc, dist; float bladeLen = 0; trace_t tr; - evasionType_t evasionType; + evasionType_e evasionType; // FIXME: reborn don't block enough anymore /* diff --git a/game/NPC_AI_Mark1.cpp b/game/NPC_AI_Mark1.cpp index 4613fef..c75c318 100644 --- a/game/NPC_AI_Mark1.cpp +++ b/game/NPC_AI_Mark1.cpp @@ -23,16 +23,7 @@ #define BOWCASTER_SPLASH_RADIUS 0 // Local state enums -enum { - LSTATE_NONE = 0, - LSTATE_ASLEEP, - LSTATE_WAKEUP, - LSTATE_FIRED0, - LSTATE_FIRED1, - LSTATE_FIRED2, - LSTATE_FIRED3, - LSTATE_FIRED4, -}; +enum localState_e { LSTATE_NONE = 0, LSTATE_ASLEEP, LSTATE_WAKEUP, LSTATE_FIRED0, LSTATE_FIRED1, LSTATE_FIRED2, LSTATE_FIRED3, LSTATE_FIRED4 }; void Mark1_BlasterAttack(qboolean advance); void DeathFX(gentity_t *ent); diff --git a/game/NPC_AI_Mark2.cpp b/game/NPC_AI_Mark2.cpp index d27bd8c..e496df9 100644 --- a/game/NPC_AI_Mark2.cpp +++ b/game/NPC_AI_Mark2.cpp @@ -11,12 +11,7 @@ #define MIN_DISTANCE_SQR (MIN_DISTANCE * MIN_DISTANCE) // Local state enums -enum { - LSTATE_NONE = 0, - LSTATE_DROPPINGDOWN, - LSTATE_DOWN, - LSTATE_RISINGUP, -}; +enum localState_e { LSTATE_NONE = 0, LSTATE_DROPPINGDOWN, LSTATE_DOWN, LSTATE_RISINGUP }; void NPC_Mark2_Precache(void) { G_SoundIndex("sound/chars/mark2/misc/mark2_explo"); // blows up on death diff --git a/game/NPC_AI_MineMonster.cpp b/game/NPC_AI_MineMonster.cpp index dc3b285..55ccb4c 100644 --- a/game/NPC_AI_MineMonster.cpp +++ b/game/NPC_AI_MineMonster.cpp @@ -41,7 +41,7 @@ void MineMonster_Patrol(void) { } } - // rwwFIXMEFIXME: Care about all clients, not just client 0 + // FIXME: clientNum 0 VectorSubtract(&g_entities[0].r.currentOrigin, &NPC->r.currentOrigin, &dif); if (VectorLengthSquared(&dif) < 256 * 256) { diff --git a/game/NPC_AI_Remote.cpp b/game/NPC_AI_Remote.cpp index 5cc91c2..5112958 100644 --- a/game/NPC_AI_Remote.cpp +++ b/game/NPC_AI_Remote.cpp @@ -6,9 +6,7 @@ void Remote_Strafe(void); #define VELOCITY_DECAY 0.85f // Local state enums -enum { - LSTATE_NONE = 0, -}; +enum localState_e { LSTATE_NONE = 0 }; void Remote_Idle(void); diff --git a/game/NPC_AI_Seeker.cpp b/game/NPC_AI_Seeker.cpp index 5c24228..af1a731 100644 --- a/game/NPC_AI_Seeker.cpp +++ b/game/NPC_AI_Seeker.cpp @@ -436,6 +436,7 @@ void NPC_BSSeeker_Default(void) { */ // N/A for MP. if (NPC->r.ownerNum < ENTITYNUM_NONE) { + // FIXME: clientNum 0 gentity_t *owner = &g_entities[0]; if (owner->health <= 0 || (owner->client && owner->client->pers.connected == CON_DISCONNECTED)) { // owner is dead or gone // remove me diff --git a/game/NPC_AI_Sentry.cpp b/game/NPC_AI_Sentry.cpp index 0b13f70..73779c3 100644 --- a/game/NPC_AI_Sentry.cpp +++ b/game/NPC_AI_Sentry.cpp @@ -14,14 +14,7 @@ #define SENTRY_HOVER_HEIGHT 24 // Local state enums -enum { - LSTATE_NONE = 0, - LSTATE_ASLEEP, - LSTATE_WAKEUP, - LSTATE_ACTIVE, - LSTATE_POWERING_UP, - LSTATE_ATTACKING, -}; +enum localState_e { LSTATE_NONE = 0, LSTATE_ASLEEP, LSTATE_WAKEUP, LSTATE_ACTIVE, LSTATE_POWERING_UP, LSTATE_ATTACKING }; void NPC_Sentry_Precache(void) { int i; diff --git a/game/NPC_AI_Sniper.cpp b/game/NPC_AI_Sniper.cpp index 4ecdbba..d10d8df 100644 --- a/game/NPC_AI_Sniper.cpp +++ b/game/NPC_AI_Sniper.cpp @@ -31,11 +31,7 @@ static qboolean shoot2; static float enemyDist2; // Local state enums -enum { - LSTATE_NONE = 0, - LSTATE_UNDERFIRE, - LSTATE_INVESTIGATE, -}; +enum localState_e { LSTATE_NONE = 0, LSTATE_UNDERFIRE, LSTATE_INVESTIGATE }; void Sniper_ClearTimers(gentity_t *ent) { TIMER_Set(ent, "chatter", 0); diff --git a/game/NPC_AI_Stormtrooper.cpp b/game/NPC_AI_Stormtrooper.cpp index e7c13ae..f83ba35 100644 --- a/game/NPC_AI_Stormtrooper.cpp +++ b/game/NPC_AI_Stormtrooper.cpp @@ -46,11 +46,7 @@ static vector3 impactPos; int groupSpeechDebounceTime[TEAM_NUM_TEAMS]; // used to stop several group AI from speaking all at once // Local state enums -enum { - LSTATE_NONE = 0, - LSTATE_UNDERFIRE, - LSTATE_INVESTIGATE, -}; +enum localState_e { LSTATE_NONE = 0, LSTATE_UNDERFIRE, LSTATE_INVESTIGATE }; void ST_AggressionAdjust(gentity_t *self, int change) { int upper_threshold, lower_threshold; @@ -90,24 +86,7 @@ void ST_ClearTimers(gentity_t *ent) { TIMER_Set(ent, "verifyCP", 0); } -enum { - SPEECH_CHASE, - SPEECH_CONFUSED, - SPEECH_COVER, - SPEECH_DETECTED, - SPEECH_GIVEUP, - SPEECH_LOOK, - SPEECH_LOST, - SPEECH_OUTFLANK, - SPEECH_ESCAPING, - SPEECH_SIGHT, - SPEECH_SOUND, - SPEECH_SUSPICIOUS, - SPEECH_YELL, - SPEECH_PUSHED -}; - -static void ST_Speech(gentity_t *self, int speechType, float failChance) { +static void ST_Speech(gentity_t *self, speechType_e speechType, float failChance) { if (random() < failChance) { return; } @@ -263,11 +242,11 @@ void NPC_ST_SayMovementSpeech(void) { ST_Speech(NPC, NPCInfo->movementSpeech, NPCInfo->movementSpeechChance); } - NPCInfo->movementSpeech = 0; + NPCInfo->movementSpeech = SPEECH_CHASE; NPCInfo->movementSpeechChance = 0.0f; } -void NPC_ST_StoreMovementSpeech(int speech, float chance) { +static void NPC_ST_StoreMovementSpeech(speechType_e speech, float chance) { NPCInfo->movementSpeech = speech; NPCInfo->movementSpeechChance = chance; } @@ -365,8 +344,8 @@ void NPC_BSST_Sleep(void) { // There is an event we heard if (alertEvent >= 0) { // See if it was enough to wake us up - if (level.alertEvents[alertEvent].level == AEL_DISCOVERED && - (NPCInfo->scriptFlags & SCF_LOOK_FOR_ENEMIES)) { // rwwFIXMEFIXME: Care about all clients not just 0 + if (level.alertEvents[alertEvent].level == AEL_DISCOVERED && (NPCInfo->scriptFlags & SCF_LOOK_FOR_ENEMIES)) { + // FIXME: clientNum 0 #if 0 if ( &g_entities[0] && g_entities[0].health > 0 ) { @@ -487,9 +466,9 @@ qboolean NPC_CheckEnemyStealth(gentity_t *target) { target_crouching = (target->client->pers.cmd.upmove < 0); dist_rating = (target_dist / maxViewDist); speed_rating = (target_speed / MAX_VIEW_SPEED); - turning_rating = 5.0f; // AngleDelta( target->client->ps.viewangles.pitch, target->lastAngles.pitch )/180.0f + AngleDelta( - // target->client->ps.viewangles.yaw, target->lastAngles.yaw )/180.0f; - light_level = (255 / MAX_LIGHT_INTENSITY); //( target->lightLevel / MAX_LIGHT_INTENSITY ); + turning_rating = 5.0f; // AngleDelta( target->client->ps.viewangles.pitch, target->lastAngles.pitch )/180.0f + AngleDelta( + // target->client->ps.viewangles.yaw, target->lastAngles.yaw )/180.0f; + light_level = (255 / MAX_LIGHT_INTENSITY); //( target->lightLevel / MAX_LIGHT_INTENSITY ); FOV_perc = 1.0f - (hAngle_perc + vAngle_perc) * 0.5f; // FIXME: Dunno about the average... vis_rating = 0.0f; diff --git a/game/NPC_behavior.cpp b/game/NPC_behavior.cpp index 6db8715..9c0e08d 100644 --- a/game/NPC_behavior.cpp +++ b/game/NPC_behavior.cpp @@ -177,7 +177,7 @@ void BeamOut(gentity_t *self) { self->nextthink = level.time + 1500; self->think = Disappear; self->s.teamowner = TEAM_FREE; - self->client->playerTeam = (npcteam_t)self->s.teamowner; + self->client->playerTeam = (npcteam_e)self->s.teamowner; // self->r.svFlags |= SVF_BEAMING; //this appears unused in SP as well } @@ -307,7 +307,7 @@ qboolean NPC_MoveDirClear(int forwardmove, int rightmove, qboolean reset); void NPC_BSFollowLeader(void) { vector3 vec; float leaderDist; - visibility_t leaderVis; + visibility_e leaderVis; int curAnim; if (!NPC->client->leader) { // ok, stand guard until we find an enemy @@ -635,8 +635,9 @@ void NPC_BSJump(void) { void NPC_BSRemove(void) { NPC_UpdateAngles(qtrue, qtrue); + // FIXME: clientNum 0 if (!trap->InPVS(&NPC->r.currentOrigin, &g_entities[0].r.currentOrigin)) // FIXME: use cg.vieworg? - { // rwwFIXMEFIXME: Care about all clients instead of just 0? + { G_UseTargets2(NPC, NPC, NPC->target3); NPC->s.eFlags |= EF_NODRAW; NPC->s.eType = ET_INVISIBLE; @@ -804,7 +805,7 @@ void NPC_BSSearch(void) { NPC_UpdateAngles(qtrue, qtrue); } -void NPC_BSSearchStart(int homeWp, bState_t bState) { +void NPC_BSSearchStart(int homeWp, bState_e bState) { // FIXME: Reimplement if (homeWp == WAYPOINT_NONE) { homeWp = NAV_FindClosestWaypointForEnt(NPC, WAYPOINT_NONE); diff --git a/game/NPC_combat.cpp b/game/NPC_combat.cpp index 74514fc..b9ade7b 100644 --- a/game/NPC_combat.cpp +++ b/game/NPC_combat.cpp @@ -1024,11 +1024,11 @@ qboolean CanShoot(gentity_t *ent, gentity_t *shooter) { } /* -void NPC_CheckPossibleEnemy( gentity_t *other, visibility_t vis ) +void NPC_CheckPossibleEnemy( gentity_t *other, visibility_e vis ) Added: hacks for scripted NPCs */ -void NPC_CheckPossibleEnemy(gentity_t *other, visibility_t vis) { +void NPC_CheckPossibleEnemy(gentity_t *other, visibility_e vis) { // is he is already our enemy? if (other == NPC->enemy) return; @@ -1192,7 +1192,7 @@ gentity_t *NPC_PickEnemy(gentity_t *closestTo, int enemyTeam, qboolean checkVis, float bestDist = Q3_INFINITE; qboolean failed = qfalse; int visChecks = (CHECK_360 | CHECK_FOV | CHECK_VISRANGE); - visibility_t minVis = VIS_FOV; + visibility_e minVis = VIS_FOV; if (enemyTeam == NPCTEAM_NEUTRAL) { return NULL; @@ -1206,6 +1206,7 @@ gentity_t *NPC_PickEnemy(gentity_t *closestTo, int enemyTeam, qboolean checkVis, } if (findPlayersFirst) { // try to find a player first + // FIXME: clientNum 0 newenemy = &g_entities[0]; if (newenemy->client && !(newenemy->flags & FL_NOTARGET) && !(newenemy->s.eFlags & EF_NODRAW)) { if (newenemy->health > 0) { diff --git a/game/NPC_reactions.cpp b/game/NPC_reactions.cpp index ce49de1..7a9da31 100644 --- a/game/NPC_reactions.cpp +++ b/game/NPC_reactions.cpp @@ -6,7 +6,7 @@ qboolean G_CheckForStrongAttackMomentum(gentity_t *self); void G_AddVoiceEvent(gentity_t *self, int event, int speakDebounceTime); void cgi_S_StartSound(vector3 *origin, int entityNum, int entchannel, sfxHandle_t sfx); -qboolean Q3_TaskIDPending(gentity_t *ent, taskID_t taskType); +qboolean Q3_TaskIDPending(gentity_t *ent, taskID_e taskType); qboolean NPC_CheckLookTarget(gentity_t *self); qboolean Jedi_WaitingAmbush(gentity_t *self); void Jedi_Ambush(gentity_t *self); @@ -78,6 +78,7 @@ static void NPC_CheckAttacker(gentity_t *other, int mod) { } } // Special case player interactions + // FIXME: clientNum 0 if (other == &g_entities[0]) { // Account for the skill level to skew the results float luckThreshold; @@ -275,7 +276,7 @@ void NPC_ChoosePainAnimation(gentity_t *self, gentity_t *other, vector3 *point, } void NPC_Pain(gentity_t *self, gentity_t *attacker, int damage) { - npcteam_t otherTeam = NPCTEAM_FREE; + npcteam_e otherTeam = NPCTEAM_FREE; int voiceEvent = -1; gentity_t *other = attacker; int mod = gPainMOD; diff --git a/game/NPC_senses.cpp b/game/NPC_senses.cpp index 2570fc5..7ed476c 100644 --- a/game/NPC_senses.cpp +++ b/game/NPC_senses.cpp @@ -222,7 +222,7 @@ qboolean InVisrange(gentity_t *ent) { // FIXME: make a calculate visibility for NPC_CheckVisibility */ -visibility_t NPC_CheckVisibility(gentity_t *ent, uint32_t flags) { +visibility_e NPC_CheckVisibility(gentity_t *ent, uint32_t flags) { // flags should never be 0 if (!flags) { return VIS_NOT; @@ -277,9 +277,9 @@ visibility_t NPC_CheckVisibility(gentity_t *ent, uint32_t flags) { return VIS_SHOOT; } -static int G_CheckSoundEvents(gentity_t *self, float maxHearDist, int ignoreAlert, qboolean mustHaveOwner, alertEventLevel_t minAlertLevel) { +static int G_CheckSoundEvents(gentity_t *self, float maxHearDist, int ignoreAlert, qboolean mustHaveOwner, alertEventLevel_e minAlertLevel) { int bestEvent = -1; - alertEventLevel_t bestAlert = AEL_NONE; + alertEventLevel_e bestAlert = AEL_NONE; int bestTime = -1; int i; float dist, radius; @@ -344,7 +344,7 @@ float G_GetLightLevel(vector3 *pos, vector3 *fromDir) { return lightLevel; } -static int G_CheckSightEvents(gentity_t *self, int hFOV, int vFOV, float maxSeeDist, int ignoreAlert, qboolean mustHaveOwner, alertEventLevel_t minAlertLevel) { +static int G_CheckSightEvents(gentity_t *self, int hFOV, int vFOV, float maxSeeDist, int ignoreAlert, qboolean mustHaveOwner, alertEventLevel_e minAlertLevel) { int bestEvent = -1; int bestAlert = -1; int bestTime = -1; @@ -412,13 +412,14 @@ int G_CheckAlertEvents(gentity_t *self, qboolean checkSight, qboolean checkSound int bestSoundAlert = -1; int bestSightAlert = -1; - if (&g_entities[0] == NULL || g_entities[0].health <= 0) { + // FIXME: clientNum 0 + if (!g_entities[0].inuse || g_entities[0].health <= 0) { // player is dead return -1; } // get sound event - bestSoundEvent = G_CheckSoundEvents(self, maxHearDist, ignoreAlert, mustHaveOwner, (alertEventLevel_t)minAlertLevel); + bestSoundEvent = G_CheckSoundEvents(self, maxHearDist, ignoreAlert, mustHaveOwner, (alertEventLevel_e)minAlertLevel); // get sound event alert level if (bestSoundEvent >= 0) { bestSoundAlert = level.alertEvents[bestSoundEvent].level; @@ -427,10 +428,10 @@ int G_CheckAlertEvents(gentity_t *self, qboolean checkSight, qboolean checkSound // get sight event if (self->NPC) { bestSightEvent = - G_CheckSightEvents(self, self->NPC->stats.hfov, self->NPC->stats.vfov, maxSeeDist, ignoreAlert, mustHaveOwner, (alertEventLevel_t)minAlertLevel); + G_CheckSightEvents(self, self->NPC->stats.hfov, self->NPC->stats.vfov, maxSeeDist, ignoreAlert, mustHaveOwner, (alertEventLevel_e)minAlertLevel); } else { // FIXME: look at cg_view to get more accurate numbers? - bestSightEvent = G_CheckSightEvents(self, 80, 80, maxSeeDist, ignoreAlert, mustHaveOwner, (alertEventLevel_t)minAlertLevel); + bestSightEvent = G_CheckSightEvents(self, 80, 80, maxSeeDist, ignoreAlert, mustHaveOwner, (alertEventLevel_e)minAlertLevel); } // get sight event alert level if (bestSightEvent >= 0) { @@ -488,7 +489,7 @@ qboolean NPC_CheckForDanger(int alertEvent) { // FIXME: more bStates need to cal qboolean RemoveOldestAlert(void); -void AddSoundEvent(gentity_t *owner, vector3 *position, float radius, alertEventLevel_t alertLevel, qboolean needLOS) { +void AddSoundEvent(gentity_t *owner, vector3 *position, float radius, alertEventLevel_e alertLevel, qboolean needLOS) { // FIXME: Handle this in another manner? if (level.numAlertEvents >= MAX_ALERT_EVENTS) { if (!RemoveOldestAlert()) { // how could that fail? @@ -520,7 +521,7 @@ void AddSoundEvent(gentity_t *owner, vector3 *position, float radius, alertEvent level.numAlertEvents++; } -void AddSightEvent(gentity_t *owner, vector3 *position, float radius, alertEventLevel_t alertLevel, float addLight) { +void AddSightEvent(gentity_t *owner, vector3 *position, float radius, alertEventLevel_e alertLevel, float addLight) { // FIXME: Handle this in another manner? if (level.numAlertEvents >= MAX_ALERT_EVENTS) { if (!RemoveOldestAlert()) { // how could that fail? @@ -614,8 +615,7 @@ qboolean G_ClearLOS(gentity_t *self, const vector3 *start, const vector3 *end) { trap->Trace(&tr, start, NULL, NULL, end, ENTITYNUM_NONE, CONTENTS_OPAQUE /*CONTENTS_SOLID*/ /*(CONTENTS_SOLID|CONTENTS_MONSTERCLIP)*/, qfalse, 0, 0); while (tr.fraction < 1.0f && traceCount < 3) { // can see through 3 panes of glass if (tr.entityNum < ENTITYNUM_WORLD) { - if (&g_entities[tr.entityNum] != NULL && (g_entities[tr.entityNum].r.svFlags & SVF_GLASS_BRUSH)) { // can see through glass, trace again, ignoring - // me + if (g_entities[tr.entityNum].inuse && (g_entities[tr.entityNum].r.svFlags & SVF_GLASS_BRUSH)) { // can see through glass, trace again, ignoring me trap->Trace(&tr, &tr.endpos, NULL, NULL, end, tr.entityNum, MASK_OPAQUE, qfalse, 0, 0); traceCount++; continue; diff --git a/game/NPC_spawn.cpp b/game/NPC_spawn.cpp index 00a9175..6043e64 100644 --- a/game/NPC_spawn.cpp +++ b/game/NPC_spawn.cpp @@ -11,7 +11,7 @@ void G_DebugPrint(int level, const char *format, ...); void Q3_SetParm(int entID, int parmNum, const char *parmValue); -team_t TranslateTeamName(const char *name); +team_e TranslateTeamName(const char *name); extern const char *TeamNames[TEAM_NUM_TEAMS]; void PM_SetTorsoAnimTimer(gentity_t *ent, int *torsoAnimTimer, int time); @@ -27,7 +27,7 @@ void Wampa_SetBolts(gentity_t *self); #define NSF_DROP_TO_FLOOR 16 -int WP_SetSaberModel(gclient_t *client, class_t npcClass) { +int WP_SetSaberModel(gclient_t *client, class_e npcClass) { // rwwFIXMEFIXME: Do something here, need to let the client know. return 1; } @@ -364,7 +364,7 @@ void NPC_SetMiscDefaultData(gentity_t *ent) { } } -int NPC_WeaponsForTeam(team_t team, int spawnflags, const char *NPC_type) { +int NPC_WeaponsForTeam(team_e team, int spawnflags, const char *NPC_type) { //*** not sure how to handle this, should I pass in class instead of team and go from there? - dmv switch (team) { // no longer exists @@ -568,13 +568,13 @@ void ChangeWeapon(gentity_t *ent, int newWeapon); void NPC_SetWeapons(gentity_t *ent) { int bestWeap = WP_NONE; int curWeap; - int weapons = NPC_WeaponsForTeam((team_t)ent->client->playerTeam, ent->spawnflags, ent->NPC_type); + int weapons = NPC_WeaponsForTeam((team_e)ent->client->playerTeam, ent->spawnflags, ent->NPC_type); ent->client->ps.stats[STAT_WEAPONS] = 0; for (curWeap = WP_SABER; curWeap < WP_NUM_WEAPONS; curWeap++) { if ((weapons & (1 << curWeap))) { ent->client->ps.stats[STAT_WEAPONS] |= (1 << curWeap); - // RegisterItem( FindItemForWeapon( (weapon_t)(curWeap) ) ); //precache the weapon + // RegisterItem( FindItemForWeapon( (weapon_e)(curWeap) ) ); //precache the weapon // rwwFIXMEFIXME: Precache ent->NPC->currentAmmo = ent->client->ps.ammo[weaponData[curWeap].ammoIndex] = 100; // FIXME: max ammo @@ -914,6 +914,7 @@ void NPC_Begin(gentity_t *ent) { if (ent->client->playerTeam == NPCTEAM_ENEMY) { // valid enemy spawned if (!(ent->spawnflags & SFB_CINEMATIC) && ent->NPC->behaviorState != BS_CINEMATIC) { // not a cinematic enemy + // FIXME: clientNum 0 if (g_entities[0].client) { // g_entities[0].client->sess.missionStats.enemiesSpawned++; // rwwFIXMEFIXME: Do something here? And this is a rather strange place to be storing @@ -1222,7 +1223,7 @@ gentity_t *NPC_Spawn_Do(gentity_t *ent) { if (g_entities[n].s.eType != ET_NPC && g_entities[n].client) { VectorCopy(&g_entities[n].s.origin, &newent->s.origin); newent->s.teamowner = g_entities[n].client->playerTeam; - newent->client->playerTeam = (npcteam_t)newent->s.teamowner; + newent->client->playerTeam = (npcteam_e)newent->s.teamowner; break; } } @@ -1275,7 +1276,7 @@ gentity_t *NPC_Spawn_Do(gentity_t *ent) { int parmNum; for (parmNum = 0; parmNum < MAX_PARMS; parmNum++) { - if (ent->parms->parm[parmNum] && ent->parms->parm[parmNum][0]) { + if (ent->parms->parm[parmNum][0]) { Q3_SetParm(newent->s.number, parmNum, ent->parms->parm[parmNum]); } } @@ -1313,13 +1314,13 @@ gentity_t *NPC_Spawn_Do(gentity_t *ent) { newent->alliedTeam = ent->alliedTeam; newent->teamnodmg = ent->teamnodmg; if (ent->team && ent->team[0]) { // specified team directly? - newent->client->sess.sessionTeam = (team_t)atoi(ent->team); + newent->client->sess.sessionTeam = (team_e)atoi(ent->team); } else if (newent->s.teamowner != TEAM_FREE) { - newent->client->sess.sessionTeam = (team_t)newent->s.teamowner; + newent->client->sess.sessionTeam = (team_e)newent->s.teamowner; } else if (newent->alliedTeam != TEAM_FREE) { - newent->client->sess.sessionTeam = (team_t)newent->alliedTeam; + newent->client->sess.sessionTeam = (team_e)newent->alliedTeam; } else if (newent->teamnodmg != TEAM_FREE) { - newent->client->sess.sessionTeam = (team_t)newent->teamnodmg; + newent->client->sess.sessionTeam = (team_e)newent->teamnodmg; } else { newent->client->sess.sessionTeam = TEAM_FREE; } @@ -1357,7 +1358,7 @@ void NPC_ShySpawn(gentity_t *ent) { ent->nextthink = level.time + SHY_THINK_TIME; ent->think = NPC_ShySpawn; - // rwwFIXMEFIXME: Care about other clients not just 0? + // FIXME: clientNum 0 if (DistanceSquared(&g_entities[0].r.currentOrigin, &ent->r.currentOrigin) <= SHY_SPAWN_DISTANCE_SQR) return; @@ -3278,7 +3279,7 @@ void NPC_Kill_f(void) { int n; gentity_t *player; char name[1024]; - npcteam_t killTeam = NPCTEAM_FREE; + npcteam_e killTeam = NPCTEAM_FREE; qboolean killNonSF = qfalse; trap->Argv(2, name, 1024); @@ -3309,7 +3310,7 @@ void NPC_Kill_f(void) { if (!Q_stricmp("nonally", name)) { killNonSF = qtrue; } else { - killTeam = (npcteam_t)GetIDForString(TeamTable, name); + killTeam = (npcteam_e)GetIDForString(TeamTable, name); if (killTeam == NPCTEAM_FREE) { Com_Printf(S_COLOR_RED "NPC_Kill Error: team '%s' not recognized\n", name); diff --git a/game/NPC_stats.cpp b/game/NPC_stats.cpp index a7724cc..69eb24b 100644 --- a/game/NPC_stats.cpp +++ b/game/NPC_stats.cpp @@ -10,7 +10,7 @@ qboolean WP_SaberParseParms(const char *SaberName, saberInfo_t *saber); void WP_RemoveSaber(saberInfo_t *sabers, int saberNum); const stringID_table_t TeamTable[] = { - ENUM2STRING(NPCTEAM_FREE), // caution, some code checks a team_t via "if (!team_t_varname)" so I guess this should stay as entry 0, great or what? -slc + ENUM2STRING(NPCTEAM_FREE), // caution, some code checks a team_e via "if (!team_t_varname)" so I guess this should stay as entry 0, great or what? -slc ENUM2STRING(NPCTEAM_PLAYER), ENUM2STRING(NPCTEAM_ENEMY), ENUM2STRING(NPCTEAM_NEUTRAL), // most droids are team_neutral, there are some exceptions like Probe,Seeker,Interrogator @@ -153,7 +153,7 @@ qboolean BG_ParseLiteral(const char **data, const char *string); static std::string NPCParms = ""; // Should be used to determine pip bolt-ons -static rank_t TranslateRankName(const char *name) { +static rank_e TranslateRankName(const char *name) { if (!Q_stricmp(name, "civilian")) { return RANK_CIVILIAN; } @@ -399,14 +399,14 @@ void NPC_PrecacheAnimationCFG(const char *NPC_type) { #endif } -int NPC_WeaponsForTeam(team_t team, int spawnflags, const char *NPC_type); -void NPC_PrecacheWeapons(npcteam_t playerTeam, int spawnflags, const char *NPCtype) { - int weapons = NPC_WeaponsForTeam((team_t)playerTeam, spawnflags, NPCtype); +int NPC_WeaponsForTeam(team_e team, int spawnflags, const char *NPC_type); +void NPC_PrecacheWeapons(npcteam_e playerTeam, int spawnflags, const char *NPCtype) { + int weapons = NPC_WeaponsForTeam((team_e)playerTeam, spawnflags, NPCtype); int curWeap; for (curWeap = WP_SABER; curWeap < WP_NUM_WEAPONS; curWeap++) { if (weapons & (1 << curWeap)) { - RegisterItem(BG_FindItemForWeapon((weapon_t)curWeap)); + RegisterItem(BG_FindItemForWeapon((weapon_e)curWeap)); } } @@ -417,7 +417,7 @@ void NPC_PrecacheWeapons(npcteam_t playerTeam, int spawnflags, const char *NPCty { if ( (weapons & ( 1 << curWeap )) ) { - item = FindItemForWeapon( ((weapon_t)(curWeap)) ); //precache the weapon + item = FindItemForWeapon( ((weapon_e)(curWeap)) ); //precache the weapon CG_RegisterItemSounds( (item-bg_itemlist) ); CG_RegisterItemVisuals( (item-bg_itemlist) ); //precache the in-hand/in-world ghoul2 weapon model @@ -446,7 +446,7 @@ Precaches NPC skins, tgas and md3s. */ void NPC_Precache(gentity_t *spawner) { - npcteam_t playerTeam = NPCTEAM_FREE; + npcteam_e playerTeam = NPCTEAM_FREE; const char *token; const char *value; const char *p; @@ -565,7 +565,7 @@ void NPC_Precache(gentity_t *spawner) { } // playerTeam = TranslateTeamName(value); Com_sprintf(tk, sizeof(tk), "NPC%s", token); - playerTeam = (npcteam_t)GetIDForString(TeamTable, tk); + playerTeam = (npcteam_e)GetIDForString(TeamTable, tk); continue; } @@ -647,7 +647,7 @@ void NPC_Precache(gentity_t *spawner) { curWeap = GetIDForString(WPTable, value); if (curWeap > WP_NONE && curWeap < WP_NUM_WEAPONS) { - RegisterItem(BG_FindItemForWeapon((weapon_t)curWeap)); + RegisterItem(BG_FindItemForWeapon((weapon_e)curWeap)); } continue; } @@ -1500,7 +1500,7 @@ qboolean NPC_ParseParms(const char *NPCName, gentity_t *NPC) { } Com_sprintf(tk, sizeof(tk), "NPC%s", token); NPC->s.teamowner = GetIDForString(TeamTable, tk); // TranslateTeamName(value); - NPC->client->playerTeam = (npcteam_t)NPC->s.teamowner; + NPC->client->playerTeam = (npcteam_e)NPC->s.teamowner; continue; } @@ -1512,7 +1512,7 @@ qboolean NPC_ParseParms(const char *NPCName, gentity_t *NPC) { continue; } Com_sprintf(tk, sizeof(tk), "NPC%s", token); - NPC->client->enemyTeam = (npcteam_t)GetIDForString(TeamTable, tk); // TranslateTeamName(value); + NPC->client->enemyTeam = (npcteam_e)GetIDForString(TeamTable, tk); // TranslateTeamName(value); continue; } @@ -1521,7 +1521,7 @@ qboolean NPC_ParseParms(const char *NPCName, gentity_t *NPC) { if (COM_ParseString(&p, &value)) { continue; } - NPC->client->NPC_class = (class_t)GetIDForString(ClassTable, value); + NPC->client->NPC_class = (class_e)GetIDForString(ClassTable, value); NPC->s.NPC_class = NPC->client->NPC_class; // we actually only need this value now, but at the moment I don't feel like changing the 200+ // references to client->NPC_class. @@ -1770,7 +1770,7 @@ qboolean NPC_ParseParms(const char *NPCName, gentity_t *NPC) { continue; } if (NPC->NPC) { - NPC->NPC->defaultBehavior = (bState_t)(n); + NPC->NPC->defaultBehavior = (bState_e)(n); } continue; } @@ -1860,7 +1860,7 @@ qboolean NPC_ParseParms(const char *NPCName, gentity_t *NPC) { NPC->client->ps.weapon = weap; NPC->client->ps.stats[STAT_WEAPONS] |= (1 << NPC->client->ps.weapon); if (weap > WP_NONE) { - // RegisterItem( FindItemForWeapon( (weapon_t)(NPC->client->ps.weapon) ) ); //precache the weapon + // RegisterItem( FindItemForWeapon( (weapon_e)(NPC->client->ps.weapon) ) ); //precache the weapon NPC->client->ps.ammo[weaponData[NPC->client->ps.weapon].ammoIndex] = 100; // FIXME: max ammo! } } diff --git a/game/NPC_utils.cpp b/game/NPC_utils.cpp index 1e5a8c2..a4df51f 100644 --- a/game/NPC_utils.cpp +++ b/game/NPC_utils.cpp @@ -12,12 +12,12 @@ int teamCounter[TEAM_NUM_TEAMS]; void G_DebugPrint(int level, const char *format, ...); /* -void CalcEntitySpot ( gentity_t *ent, spot_t spot, vector3 *point ) +void CalcEntitySpot ( gentity_t *ent, spot_e spot, vector3 *point ) Added: Uses shootAngles if a NPC has them */ -void CalcEntitySpot(const gentity_t *ent, const spot_t spot, vector3 *point) { +void CalcEntitySpot(const gentity_t *ent, const spot_e spot, vector3 *point) { vector3 forward, up, right; vector3 start, end; trace_t tr; @@ -460,7 +460,7 @@ void SetTeamNumbers(void) { extern stringID_table_t BSTable[]; extern stringID_table_t BSETTable[]; qboolean G_ActivateBehavior(gentity_t *self, int bset) { - bState_t bSID = (bState_t)-1; + bState_e bSID = (bState_e)-1; char *bs_name = NULL; if (!self) { @@ -474,10 +474,10 @@ qboolean G_ActivateBehavior(gentity_t *self, int bset) { } if (self->NPC) { - bSID = (bState_t)(GetIDForString(BSTable, bs_name)); + bSID = (bState_e)(GetIDForString(BSTable, bs_name)); } - if (bSID != (bState_t)-1) { + if (bSID != (bState_e)-1) { self->NPC->tempBehavior = BS_DEFAULT; self->NPC->behaviorState = bSID; } else { @@ -801,6 +801,7 @@ gentity_t *NPC_PickEnemyExt(qboolean checkAlerts) { if (ev->level >= AEL_DISCOVERED) { // If it's the player, attack him + // FIXME: clientNum 0 if (ev->owner == &g_entities[0]) return ev->owner; @@ -814,7 +815,10 @@ gentity_t *NPC_PickEnemyExt(qboolean checkAlerts) { return NULL; } -qboolean NPC_FindPlayer(void) { return NPC_TargetVisible(&g_entities[0]); } +qboolean NPC_FindPlayer(void) { + // FIXME: clientNum 0 + return NPC_TargetVisible(&g_entities[0]); +} static qboolean NPC_CheckPlayerDistance(void) { return qfalse; // MOOT in MP @@ -1030,8 +1034,7 @@ void NPC_SetLookTarget(gentity_t *self, int entNum, int clearTime) { qboolean NPC_CheckLookTarget(gentity_t *self) { if (self->client) { if (self->client->renderInfo.lookTarget >= 0 && self->client->renderInfo.lookTarget < ENTITYNUM_WORLD) { // within valid range - if ((&g_entities[self->client->renderInfo.lookTarget] == NULL) || - !g_entities[self->client->renderInfo.lookTarget].inuse) { // lookTarget not inuse or not valid anymore + if (!g_entities[self->client->renderInfo.lookTarget].inuse) { // lookTarget not inuse or not valid anymore NPC_ClearLookTarget(self); } else if (self->client->renderInfo.lookTargetClearTime && self->client->renderInfo.lookTargetClearTime < level.time) { // Time to clear lookTarget NPC_ClearLookTarget(self); @@ -1052,8 +1055,8 @@ void G_AddVoiceEvent(gentity_t *self, int event, int speakDebounceTime); void NPC_CheckCharmed(void) { if (NPCInfo->charmedTime && NPCInfo->charmedTime < level.time && NPC->client) { // we were charmed, set us back! - NPC->client->playerTeam = (npcteam_t)NPC->genericValue1; - NPC->client->enemyTeam = (npcteam_t)NPC->genericValue2; + NPC->client->playerTeam = (npcteam_e)NPC->genericValue1; + NPC->client->enemyTeam = (npcteam_e)NPC->genericValue2; NPC->s.teamowner = NPC->genericValue3; NPC->client->leader = NULL; diff --git a/game/SpeederNPC.cpp b/game/SpeederNPC.cpp index c542c45..f7cdb47 100644 --- a/game/SpeederNPC.cpp +++ b/game/SpeederNPC.cpp @@ -14,7 +14,7 @@ extern vector3 playerMins; extern vector3 playerMaxs; void ChangeWeapon(gentity_t *ent, int newWeapon); void PM_SetAnim(pmove_t *pm, int setAnimParts, int anim, uint32_t setAnimFlags, int blendTime); -int PM_AnimLength(int index, animNumber_t anim); +int PM_AnimLength(int index, animNumber_e anim); #endif void BG_SetAnim(playerState_t *ps, animation_t *animations, int setAnimParts, int anim, uint32_t setAnimFlags, int blendTime); @@ -255,7 +255,7 @@ void AnimateVehicle(Vehicle_t *pVeh) {} // would be nice to have proper prediction of animations. -rww // This function makes sure that the rider's in this vehicle are properly animated. void AnimateRiders(Vehicle_t *pVeh) { - animNumber_t Anim = BOTH_VS_IDLE; + animNumber_e Anim = BOTH_VS_IDLE; int iFlags = SETANIM_FLAG_NORMAL, iBlend = 300; playerState_t *pilotPS; int curTime; @@ -320,7 +320,7 @@ void AnimateRiders(Vehicle_t *pVeh) { qboolean Right = (pVeh->m_ucmd.rightmove > 0); qboolean Left = (pVeh->m_ucmd.rightmove < 0); qboolean Turbo = (curTime < pVeh->m_iTurboTime); - EWeaponPose WeaponPose = WPOSE_NONE; + weaponPose_e WeaponPose = WPOSE_NONE; // Remove Crashing Flag pVeh->m_ulFlags &= ~VEH_CRASHING; diff --git a/game/WalkerNPC.cpp b/game/WalkerNPC.cpp index 883c1a7..0af7d82 100644 --- a/game/WalkerNPC.cpp +++ b/game/WalkerNPC.cpp @@ -14,7 +14,7 @@ float DotToSpot(vector3 *spot, vector3 *from, vector3 *fromAngles); vector3 playerMins; vector3 playerMaxs; void PM_SetAnim(pmove_t *pm, int setAnimParts, int anim, uint32_t setAnimFlags, int blendTime); -int PM_AnimLength(int index, animNumber_t anim); +int PM_AnimLength(int index, animNumber_e anim); void Vehicle_SetAnim(gentity_t *ent, int setAnimParts, int anim, uint32_t setAnimFlags, int iBlend); void G_VehicleTrace(trace_t *results, const vector3 *start, const vector3 *tMins, const vector3 *tMaxs, const vector3 *end, int passEntityNum, int contentmask); @@ -253,7 +253,7 @@ static void ProcessOrientCommands(Vehicle_t *pVeh) { #ifdef PROJECT_GAME // back to our game-only functions // This function makes sure that the vehicle is properly animated. static void AnimateVehicle(Vehicle_t *pVeh) { - animNumber_t Anim = BOTH_STAND1; + animNumber_e Anim = BOTH_STAND1; int iFlags = SETANIM_FLAG_NORMAL, iBlend = 300; gentity_t *parent = (gentity_t *)pVeh->m_pParentEntity; float fSpeedPercToMax; diff --git a/game/ai.h b/game/ai.h index 32d4367..c3c4d1c 100644 --- a/game/ai.h +++ b/game/ai.h @@ -1,18 +1,21 @@ #pragma once +#include "qcommon/q_shared.h" +#include "game/g_local.h" + // Distance ratings -typedef enum { +enum distance_e { DIST_MELEE, DIST_LONG, -} distance_e; +}; // Attack types -typedef enum { +enum attack_e { ATTACK_MELEE, ATTACK_RANGE, -} attack_e; +}; -enum { +enum squadState_e { SQUAD_IDLE, // No target found, waiting SQUAD_STAND_AND_SHOOT, // Standing in position and shoot (no cover) SQUAD_RETREAT, // Running away from combat @@ -24,15 +27,7 @@ enum { }; // sigh... had to move in here for groupInfo -typedef enum //# rank_e -{ RANK_CIVILIAN, - RANK_CREWMAN, - RANK_ENSIGN, - RANK_LT_JG, - RANK_LT, - RANK_LT_COMM, - RANK_COMMANDER, - RANK_CAPTAIN } rank_t; +enum rank_e { RANK_CIVILIAN, RANK_CREWMAN, RANK_ENSIGN, RANK_LT_JG, RANK_LT, RANK_LT_COMM, RANK_COMMANDER, RANK_CAPTAIN }; qboolean NPC_CheckPlayerTeamStealth(void); @@ -89,7 +84,7 @@ typedef struct AIGroupMember_s { typedef struct AIGroupInfo_s { int numGroup; qboolean processed; - npcteam_t team; + npcteam_e team; gentity_t *enemy; int enemyWP; int speechDebounceTime; @@ -106,10 +101,10 @@ typedef struct AIGroupInfo_s { AIGroupMember_t member[MAX_GROUP_MEMBERS]; } AIGroupInfo_t; -int AI_GetGroupSize(vector3 *origin, int radius, team_t playerTeam, gentity_t *avoid); +int AI_GetGroupSize(vector3 *origin, int radius, team_e playerTeam, gentity_t *avoid); int AI_GetGroupSize2(gentity_t *ent, int radius); void AI_GetGroup(gentity_t *self); qboolean AI_CheckEnemyCollision(gentity_t *ent, qboolean takeEnemy); -gentity_t *AI_DistributeAttack(gentity_t *attacker, gentity_t *enemy, team_t team, int threshold); +gentity_t *AI_DistributeAttack(gentity_t *attacker, gentity_t *enemy, team_e team, int threshold); diff --git a/game/ai_main.cpp b/game/ai_main.cpp index a6bfd71..57d2cfb 100644 --- a/game/ai_main.cpp +++ b/game/ai_main.cpp @@ -2358,12 +2358,12 @@ int Siege_TargetClosestObjective(bot_state_t *bs, int flag) { VectorSet(&maxs, 1, 1, 1); if (bs->wpDestination && (bs->wpDestination->flags & flag) && bs->wpDestination->associated_entity != ENTITYNUM_NONE && - &g_entities[bs->wpDestination->associated_entity] && g_entities[bs->wpDestination->associated_entity].use) { + g_entities[bs->wpDestination->associated_entity].inuse && g_entities[bs->wpDestination->associated_entity].use) { goto hasPoint; } for (int i = 0, size = gWPArray.size(); i < size; i++) { - if (gWPArray[i] && (gWPArray[i]->flags & flag) && gWPArray[i]->associated_entity != ENTITYNUM_NONE && &g_entities[gWPArray[i]->associated_entity] && + if (gWPArray[i] && (gWPArray[i]->flags & flag) && gWPArray[i]->associated_entity != ENTITYNUM_NONE && g_entities[gWPArray[i]->associated_entity].inuse && g_entities[gWPArray[i]->associated_entity].use) { VectorSubtract(&gWPArray[i]->origin, &bs->origin, &a); testdistance = VectorLength(&a); diff --git a/game/ai_main.h b/game/ai_main.h index 11e1f0c..87dac33 100644 --- a/game/ai_main.h +++ b/game/ai_main.h @@ -1,6 +1,7 @@ #include -#include "bg_saga.h" +#include "qcommon/q_shared.h" +#include "game/bg_saga.h" //#define FORCEJUMP_INSTANTMETHOD 1 @@ -81,7 +82,7 @@ #define BOT_SABER_THROW_RANGE 800 -typedef enum { +enum bot_ctf_state_e { CTFSTATE_NONE, CTFSTATE_ATTACKER, CTFSTATE_DEFENDER, @@ -89,11 +90,11 @@ typedef enum { CTFSTATE_GUARDCARRIER, CTFSTATE_GETFLAGHOME, CTFSTATE_MAXCTFSTATES -} bot_ctf_state_t; +}; -typedef enum { SIEGESTATE_NONE, SIEGESTATE_ATTACKER, SIEGESTATE_DEFENDER, SIEGESTATE_MAXSIEGESTATES } bot_siege_state_t; +enum bot_siege_state_e { SIEGESTATE_NONE, SIEGESTATE_ATTACKER, SIEGESTATE_DEFENDER, SIEGESTATE_MAXSIEGESTATES }; -typedef enum { TEAMPLAYSTATE_NONE, TEAMPLAYSTATE_FOLLOWING, TEAMPLAYSTATE_ASSISTING, TEAMPLAYSTATE_REGROUP, TEAMPLAYSTATE_MAXTPSTATES } bot_teamplay_state_t; +enum bot_teamplay_state_e { TEAMPLAYSTATE_NONE, TEAMPLAYSTATE_FOLLOWING, TEAMPLAYSTATE_ASSISTING, TEAMPLAYSTATE_REGROUP, TEAMPLAYSTATE_MAXTPSTATES }; typedef struct botattachment_s { int level; diff --git a/game/ai_wpnav.cpp b/game/ai_wpnav.cpp index e81fbe6..516ee5e 100644 --- a/game/ai_wpnav.cpp +++ b/game/ai_wpnav.cpp @@ -1627,7 +1627,7 @@ int SavePathData(const char *filename) { gWPArray[i]->disttonext = flLen; - Com_sprintf(fileString, 524288, "%s} %f\n", fileString, flLen); + Com_sprintf(fileString, 524288, "%s} %f\n", fileString, (double)flLen); i++; diff --git a/game/anims.h b/game/anims.h index 87aa2e7..a4f4513 100644 --- a/game/anims.h +++ b/game/anims.h @@ -1,6 +1,6 @@ #pragma once -typedef enum animNumber_e { +enum animNumber_e { // HEAD ANIMS //# #sep Head-only anims FACE_TALK0, //# silent @@ -1817,6 +1817,6 @@ typedef enum animNumber_e { //# #eol MAX_ANIMATIONS, MAX_TOTALANIMATIONS, -} animNumber_t; +}; #define SABER_ANIM_GROUP_SIZE (BOTH_A2_T__B_ - BOTH_A1_T__B_) diff --git a/game/b_local.h b/game/b_local.h index c12f3a9..112f09f 100644 --- a/game/b_local.h +++ b/game/b_local.h @@ -5,7 +5,6 @@ #include "g_local.h" #include "b_public.h" -#include "say.h" #include "ai.h" @@ -61,7 +60,7 @@ extern gentity_t *NPC; extern gNPC_t *NPCInfo; extern gclient_t *client; extern usercmd_t ucmd; -extern visibility_t enemyVisibility; +extern visibility_e enemyVisibility; // AI_Default qboolean NPC_CheckInvestigate(int alertEventNum); @@ -85,7 +84,7 @@ void NPC_BSFollowLeader(void); void NPC_BSJump(void); void NPC_BSRemove(void); void NPC_BSSearch(void); -void NPC_BSSearchStart(int homeWp, bState_t bState); +void NPC_BSSearchStart(int homeWp, bState_e bState); void NPC_BSWander(void); void NPC_StartFlee(gentity_t *enemy, vector3 *dangerPoint, int dangerLevel, int fleeTimeMin, int fleeTimeMax); void G_StartFlee(gentity_t *self, gentity_t *enemy, vector3 *dangerPoint, int dangerLevel, int fleeTimeMin, int fleeTimeMax); @@ -97,7 +96,7 @@ void ShootThink(void); void WeaponThink(qboolean inCombat); qboolean HaveWeapon(int weapon); qboolean CanShoot(gentity_t *ent, gentity_t *shooter); -void NPC_CheckPossibleEnemy(gentity_t *other, visibility_t vis); +void NPC_CheckPossibleEnemy(gentity_t *other, visibility_e vis); gentity_t *NPC_PickEnemy(gentity_t *closestTo, int enemyTeam, qboolean checkVis, qboolean findPlayersFirst, qboolean findClosest); gentity_t *NPC_CheckEnemy(qboolean findNew, qboolean tooFarOk, qboolean setEnemy); // setEnemy = qtrue qboolean NPC_CheckAttack(float scale); @@ -167,7 +166,7 @@ qboolean CanSee(gentity_t *ent); qboolean InFOV(gentity_t *ent, gentity_t *from, int hFOV, int vFOV); qboolean InFOV2(vector3 *origin, gentity_t *from, int hFOV, int vFOV); qboolean InFOV3(vector3 *spot, vector3 *from, vector3 *fromAngles, int hFOV, int vFOV); -visibility_t NPC_CheckVisibility(gentity_t *ent, uint32_t flags); +visibility_e NPC_CheckVisibility(gentity_t *ent, uint32_t flags); qboolean InVisrange(gentity_t *ent); // NPC_spawn @@ -183,7 +182,7 @@ extern int teamNumbers[TEAM_NUM_TEAMS]; extern int teamStrength[TEAM_NUM_TEAMS]; extern int teamCounter[TEAM_NUM_TEAMS]; -void CalcEntitySpot(const gentity_t *ent, const spot_t spot, vector3 *point); +void CalcEntitySpot(const gentity_t *ent, const spot_e spot, vector3 *point); qboolean NPC_UpdateAngles(qboolean doPitch, qboolean doYaw); void NPC_UpdateShootAngles(vector3 *angles, qboolean doPitch, qboolean doYaw); qboolean NPC_UpdateFiringAngles(qboolean doPitch, qboolean doYaw); diff --git a/game/b_public.h b/game/b_public.h index e1e0813..b6093ca 100644 --- a/game/b_public.h +++ b/game/b_public.h @@ -67,19 +67,30 @@ // extern qboolean showWaypoints; -typedef enum { VIS_UNKNOWN, VIS_NOT, VIS_PVS, VIS_360, VIS_FOV, VIS_SHOOT } visibility_t; -typedef enum { SPOT_ORIGIN, SPOT_CHEST, SPOT_HEAD, SPOT_HEAD_LEAN, SPOT_WEAPON, SPOT_LEGS, SPOT_GROUND } spot_t; - -typedef enum //# lookMode_e -{ LM_ENT = 0, - LM_INTEREST } lookMode_t; - -typedef enum //# jumpState_e -{ JS_WAITING = 0, - JS_FACING, - JS_CROUCHING, - JS_JUMPING, - JS_LANDING } jumpState_t; +enum jumpState_e { JS_WAITING = 0, JS_FACING, JS_CROUCHING, JS_JUMPING, JS_LANDING }; + +enum lookMode_e { LM_ENT = 0, LM_INTEREST }; + +enum speechType_e { + SPEECH_CHASE, + SPEECH_CONFUSED, + SPEECH_COVER, + SPEECH_DETECTED, + SPEECH_GIVEUP, + SPEECH_LOOK, + SPEECH_LOST, + SPEECH_OUTFLANK, + SPEECH_ESCAPING, + SPEECH_SIGHT, + SPEECH_SOUND, + SPEECH_SUSPICIOUS, + SPEECH_YELL, + SPEECH_PUSHED +}; + +enum spot_e { SPOT_ORIGIN, SPOT_CHEST, SPOT_HEAD, SPOT_HEAD_LEAN, SPOT_WEAPON, SPOT_LEGS, SPOT_GROUND }; + +enum visibility_e { VIS_UNKNOWN, VIS_NOT, VIS_PVS, VIS_360, VIS_FOV, VIS_SHOOT }; typedef struct gNPCstats_e { // Stats, loaded in, and can be set by scripts // AI @@ -110,12 +121,12 @@ typedef struct gNPCstats_e { // Stats, loaded in, and can be set by scripts #define MAX_ENEMY_POS_LAG 2400 #define ENEMY_POS_LAG_INTERVAL 100 #define ENEMY_POS_LAG_STEPS (MAX_ENEMY_POS_LAG / ENEMY_POS_LAG_INTERVAL) -typedef struct { +typedef struct gNPC_s { // FIXME: Put in playerInfo or something int timeOfDeath; // FIXME do we really need both of these gentity_t *touchedByPlayer; - visibility_t enemyLastVisibility; + visibility_e enemyLastVisibility; int aimTime; float desiredYaw; @@ -145,12 +156,12 @@ typedef struct { vector3 shootAngles; // Angles to where bot is shooting - fixme: make he torso turn to reflect these // extra character info - rank_t rank; // for pips + rank_e rank; // for pips // Behavior state info - bState_t behaviorState; // determines what actions he should be doing - bState_t defaultBehavior; // State bot will default to if none other set - bState_t tempBehavior; // While valid, overrides other behavior + bState_e behaviorState; // determines what actions he should be doing + bState_e defaultBehavior; // State bot will default to if none other set + bState_e tempBehavior; // While valid, overrides other behavior qboolean ignorePain; // only play pain scripts when take pain @@ -166,7 +177,7 @@ typedef struct { // bState-specific fields gentity_t *coverTarg; - jumpState_t jumpState; + jumpState_e jumpState; float followDist; // goal, navigation & pathfinding @@ -214,10 +225,10 @@ typedef struct { vector3 blockedDest; // - int combatPoint; // NPCs in bState BS_COMBAT_POINT will find their closest empty combat_point - int lastFailedCombatPoint; // NPCs in bState BS_COMBAT_POINT will find their closest empty combat_point - int movementSpeech; // what to say when you first successfully move - float movementSpeechChance; // how likely you are to say it + int combatPoint; // NPCs in bState BS_COMBAT_POINT will find their closest empty combat_point + int lastFailedCombatPoint; // NPCs in bState BS_COMBAT_POINT will find their closest empty combat_point + speechType_e movementSpeech; // what to say when you first successfully move + float movementSpeechChance; // how likely you are to say it // Testing physics at 20fps int nextBStateThink; diff --git a/game/be_aas.h b/game/be_aas.h index 618695c..a4f810d 100644 --- a/game/be_aas.h +++ b/game/be_aas.h @@ -41,12 +41,12 @@ TFL_WALK | TFL_CROUCH | TFL_BARRIERJUMP | TFL_JUMP | TFL_LADDER | TFL_WALKOFFLEDGE | TFL_SWIM | TFL_WATERJUMP | TFL_TELEPORT | TFL_ELEVATOR | TFL_AIR | \ TFL_WATER | TFL_JUMPPAD | TFL_FUNCBOB -typedef enum { +enum solid_e { SOLID_NOT, // no interaction with other objects SOLID_TRIGGER, // only touch when inside, after moving SOLID_BBOX, // touch on edge SOLID_BSP // bsp clip, touch on edge -} solid_t; +}; // a trace is returned when a box is swept through the AAS world typedef struct aas_trace_s { diff --git a/game/bg_local.h b/game/bg_local.h index 8e3eed4..9ad1165 100644 --- a/game/bg_local.h +++ b/game/bg_local.h @@ -66,13 +66,13 @@ qboolean PM_SpinningAnim(int anim); qboolean PM_InOnGroundAnim(int anim); qboolean PM_InRollComplete(playerState_t *ps, int anim); -int PM_AnimLength(int index, animNumber_t anim); +int PM_AnimLength(int index, animNumber_e anim); int PM_GetSaberStance(void); float PM_GroundDistance(void); qboolean PM_SomeoneInFront(trace_t *tr); -saberMoveName_t PM_SaberFlipOverAttackMove(void); -saberMoveName_t PM_SaberJumpAttackMove(void); +saberMoveName_e PM_SaberFlipOverAttackMove(void); +saberMoveName_e PM_SaberJumpAttackMove(void); void PM_ClipVelocity(vector3 *in, vector3 *normal, vector3 *out, float overbounce); void PM_AddTouchEnt(int entityNum); diff --git a/game/bg_lua.cpp b/game/bg_lua.cpp index 9622f2a..f4b2ac2 100644 --- a/game/bg_lua.cpp +++ b/game/bg_lua.cpp @@ -301,11 +301,11 @@ int StackDump(lua_State *L) { } // Framework functions constants -typedef enum jpLuaConsts_e { +enum jpLuaConsts_e { JPLUA_FRAMEWORK_TOSTRING, JPLUA_FRAMEWORK_PAIRS, JPLUA_FRAMEWORK_MAX, -} jpLuaConsts_t; +}; // contains lua references to framework functions, if any of these are 0 after init, we have a serious problem static int framework[JPLUA_FRAMEWORK_MAX]; @@ -1157,7 +1157,7 @@ int Export_Trace(lua_State *L) { start = CheckVector(L, 1); - size = lua_tonumber(L, 2) / 2.0f; + size = (float)(lua_tonumber(L, 2) / 2.0); VectorSet(&mins, size, size, size); VectorScale(&mins, -1.0f, &maxs); @@ -1184,7 +1184,7 @@ int Export_Trace(lua_State *L) { lua_pushinteger(L, tr.entityNum); lua_settable(L, top); lua_pushstring(L, "fraction"); - lua_pushnumber(L, tr.fraction); + lua_pushnumber(L, (double)tr.fraction); lua_settable(L, top); lua_pushstring(L, "endpos"); @@ -1198,7 +1198,7 @@ int Export_Trace(lua_State *L) { Vector_CreateRef(L, &tr.plane.normal); lua_settable(L, top2); lua_pushstring(L, "dist"); - lua_pushnumber(L, tr.plane.dist); + lua_pushnumber(L, (double)tr.plane.dist); lua_settable(L, top2); lua_pushstring(L, "type"); lua_pushinteger(L, tr.plane.type); diff --git a/game/bg_luaentity.cpp b/game/bg_luaentity.cpp index fa56103..713c5a1 100644 --- a/game/bg_luaentity.cpp +++ b/game/bg_luaentity.cpp @@ -157,7 +157,7 @@ int Entity_Create(lua_State *L) { lua_pushnil(L); const char *value, *key; - for (int i = 0; lua_next(L, 1); i++) { + while (lua_next(L, 1)) { if (lua_type(L, -2) != LUA_TSTRING) { continue; // key can be only string } @@ -186,7 +186,7 @@ int Entity_Create(lua_State *L) { luaL_getmetatable(L, "Vector.meta"); // get metatable for comparing if (lua_rawequal(L, -1, -2)) { vector3 *vector = CheckVector(L, -3); - value = va("%.0f %.0f %.0f", vector->x, vector->y, vector->z); + value = va("%.0f %.0f %.0f", (double)vector->x, (double)vector->y, (double)vector->z); lua_pop(L, 2); break; } @@ -1383,7 +1383,7 @@ void Register_Entity(lua_State *L) { #endif // JPLUA #ifdef PROJECT_GAME -void Entity_CallFunction(gentity_t *ent, entityFunc_t funcID, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4) { +void Entity_CallFunction(gentity_t *ent, entityFunc_e funcID, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4) { #ifdef JPLUA if (ent->uselua) { lua_State *L = ls.L; diff --git a/game/bg_luaentity.h b/game/bg_luaentity.h index b2a964e..2e81eff 100644 --- a/game/bg_luaentity.h +++ b/game/bg_luaentity.h @@ -3,9 +3,9 @@ #ifdef JPLUA #if defined(PROJECT_GAME) -#include "g_local.h" +#include "game/g_local.h" #elif defined(PROJECT_CGAME) -#include "cg_local.h" +#include "cgame/cg_local.h" #endif namespace JPLua { @@ -17,7 +17,7 @@ typedef centity_t jpluaEntity_t; #endif #if defined(PROJECT_GAME) -enum entityFunc_t { +enum entityFunc_e { JPLUA_ENTITY_THINK = 0, JPLUA_ENTITY_REACHED, @@ -29,7 +29,7 @@ enum entityFunc_t { JPLUA_ENTITY_MAX }; -void Entity_CallFunction(gentity_t *ent, entityFunc_t funcID, intptr_t arg1 = 0, intptr_t arg2 = 0, intptr_t arg3 = 0, intptr_t arg4 = 0); +void Entity_CallFunction(gentity_t *ent, entityFunc_e funcID, intptr_t arg1 = 0, intptr_t arg2 = 0, intptr_t arg3 = 0, intptr_t arg4 = 0); #ifdef JPLUA_INTERNALS int Entity_Create(lua_State *L); diff --git a/game/bg_luaplayer.cpp b/game/bg_luaplayer.cpp index 68067f3..bd3676e 100644 --- a/game/bg_luaplayer.cpp +++ b/game/bg_luaplayer.cpp @@ -1547,8 +1547,8 @@ static int Player_SetAnim(lua_State *L) { int animLoop = luaL_checkinteger(L, 2), animLeave = luaL_checkinteger(L, 3), flags = luaL_checkinteger(L, 4); emote_t emote; emote.name = "jplua emote"; - emote.animLoop = (animNumber_t)animLoop; - emote.animLeave = (animNumber_t)animLeave; + emote.animLoop = (animNumber_e)animLoop; + emote.animLeave = (animNumber_e)animLeave; emote.flags = flags; SetEmote(ent, &emote); diff --git a/game/bg_luasocket.h b/game/bg_luasocket.h index 98f5554..20b582b 100644 --- a/game/bg_luasocket.h +++ b/game/bg_luasocket.h @@ -53,11 +53,11 @@ namespace JPLua { -typedef enum { JPLUA_SOCKET_TCP = 0, JPLUA_SOCKET_UDP } jpluaSocketProtocol_t; +enum jpluaSocketProtocol_e { JPLUA_SOCKET_TCP = 0, JPLUA_SOCKET_UDP }; typedef struct jpluaSocket_s { unsigned int socket; - jpluaSocketProtocol_t protocol; + jpluaSocketProtocol_e protocol; sockaddr_in *sockinfo; } jpluaSocket_t; diff --git a/game/bg_luavector.cpp b/game/bg_luavector.cpp index 9ad5183..b4ace58 100644 --- a/game/bg_luavector.cpp +++ b/game/bg_luavector.cpp @@ -137,7 +137,7 @@ static int Vector_ToString(lua_State *L) { vector3 *v = CheckVector(L, 1); char str[64]; - Com_sprintf(str, sizeof(str), "%.3f %.3f %.3f", v->x, v->y, v->z); + Com_sprintf(str, sizeof(str), "%.3f %.3f %.3f", (double)v->x, (double)v->y, (double)v->z); lua_pushfstring(L, "Vector3( %s )", str); return 1; @@ -159,7 +159,7 @@ static int Vector_Cross(lua_State *L) { static int Vector_Distance(lua_State *L) { vector3 *from = CheckVector(L, 1), *to = CheckVector(L, 2); - lua_pushnumber(L, Distance(from, to)); + lua_pushnumber(L, (double)Distance(from, to)); return 1; } @@ -169,7 +169,7 @@ static int Vector_Distance(lua_State *L) { static int Vector_DistanceSquared(lua_State *L) { vector3 *from = CheckVector(L, 1), *to = CheckVector(L, 2); - lua_pushnumber(L, DistanceSquared(from, to)); + lua_pushnumber(L, (double)DistanceSquared(from, to)); return 1; } @@ -179,7 +179,7 @@ static int Vector_DistanceSquared(lua_State *L) { static int Vector_Dot(lua_State *L) { vector3 *from = CheckVector(L, 1), *to = CheckVector(L, 2); - lua_pushnumber(L, DotProduct(from, to)); + lua_pushnumber(L, (double)DotProduct(from, to)); return 1; } @@ -215,7 +215,7 @@ static int Vector_MA(lua_State *L) { static int Vector_Normalise(lua_State *L) { vector3 *v = CheckVector(L, 1); - lua_pushnumber(L, VectorNormalize(v)); + lua_pushnumber(L, (double)VectorNormalize(v)); return 1; } @@ -237,7 +237,7 @@ static int Vector_NormaliseCopy(lua_State *L) { float length = VectorNormalize2(v1, &v2); Vector_CreateRef(L, v2.x, v2.y, v2.z); - lua_pushnumber(L, length); + lua_pushnumber(L, (double)length); return 2; } diff --git a/game/bg_misc.cpp b/game/bg_misc.cpp index 7f72443..c7b3287 100644 --- a/game/bg_misc.cpp +++ b/game/bg_misc.cpp @@ -1163,7 +1163,7 @@ qboolean BG_CanUseFPNow(int gametype, playerState_t *ps, int time, forcePowers_t return qtrue; } -const gitem_t *BG_FindItemForPowerup(powerup_t pw) { +const gitem_t *BG_FindItemForPowerup(powerup_e pw) { const gitem_t *it = NULL; for (it = bg_itemlist + 1; it->classname; it++) { @@ -1174,7 +1174,7 @@ const gitem_t *BG_FindItemForPowerup(powerup_t pw) { return NULL; } -const gitem_t *BG_FindItemForHoldable(holdable_t hi) { +const gitem_t *BG_FindItemForHoldable(holdable_e hi) { const gitem_t *it = NULL; for (it = bg_itemlist + 1; it->classname; it++) { @@ -1186,7 +1186,7 @@ const gitem_t *BG_FindItemForHoldable(holdable_t hi) { return NULL; } -const gitem_t *BG_FindItemForWeapon(weapon_t wp) { +const gitem_t *BG_FindItemForWeapon(weapon_e wp) { const gitem_t *it = NULL; for (it = bg_itemlist + 1; it->classname; it++) { @@ -1198,7 +1198,7 @@ const gitem_t *BG_FindItemForWeapon(weapon_t wp) { return NULL; } -const gitem_t *BG_FindItemForAmmo(ammo_t ammo) { +const gitem_t *BG_FindItemForAmmo(ammo_e ammo) { const gitem_t *it = NULL; for (it = bg_itemlist + 1; it->classname; it++) { @@ -1305,7 +1305,7 @@ void BG_CycleForce(playerState_t *ps, int direction) { } // Get the itemlist index from the tag and type -int BG_GetItemIndexByTag(int tag, itemType_t type) { +int BG_GetItemIndexByTag(int tag, itemType_e type) { size_t i; const gitem_t *it = NULL; @@ -2430,7 +2430,7 @@ qboolean GetCPD(bgEntity_t *self, uint32_t bit) { return !!(cpd & bit); } -team_t BG_GetOpposingTeam(team_t team) { +team_e BG_GetOpposingTeam(team_e team) { if (team == TEAM_RED) { return TEAM_BLUE; } else if (team == TEAM_BLUE) { diff --git a/game/bg_panimate.cpp b/game/bg_panimate.cpp index b37a219..89f76c5 100644 --- a/game/bg_panimate.cpp +++ b/game/bg_panimate.cpp @@ -975,7 +975,7 @@ qboolean BG_InKnockDownOnGround(playerState_t *ps) { case BOTH_FORCE_GETUP_B5: case BOTH_FORCE_GETUP_B6: // at beginning of getup anim - if (BG_AnimLength(0, (animNumber_t)ps->legsAnim) - ps->legsTimer < 500) + if (BG_AnimLength(0, (animNumber_e)ps->legsAnim) - ps->legsTimer < 500) return qtrue; break; @@ -988,7 +988,7 @@ qboolean BG_InKnockDownOnGround(playerState_t *ps) { case BOTH_GETUP_FROLL_L: case BOTH_GETUP_FROLL_R: // at beginning of getup anim - if (BG_AnimLength(0, (animNumber_t)ps->legsAnim) - ps->legsTimer < 500) + if (BG_AnimLength(0, (animNumber_e)ps->legsAnim) - ps->legsTimer < 500) return qtrue; break; case BOTH_LK_DL_ST_T_SB_1_L: @@ -1384,7 +1384,7 @@ qboolean BG_FullBodyTauntAnim(int anim) { // get the "length" of an anim given the local anim index (which skeleton) and anim number. // obviously does not take things like the length of the anim while force speeding (as an example) and whatnot into account. -int BG_AnimLength(int index, animNumber_t anim) { +int BG_AnimLength(int index, animNumber_e anim) { if ((int)anim < 0 || anim >= MAX_ANIMATIONS) { return 0; } @@ -1393,7 +1393,7 @@ int BG_AnimLength(int index, animNumber_t anim) { } // just use whatever pm->animations is -int PM_AnimLength(int index, animNumber_t anim) { +int PM_AnimLength(int index, animNumber_e anim) { if (!pm->animations || (int)anim < 0 || anim >= MAX_ANIMATIONS) { return -1; } @@ -1544,7 +1544,7 @@ stringID_table_t footstepTypeTable[NUM_FOOTSTEP_TYPES + 1] = {ENUM2STRING(FOOTST // must be terminated {NULL, -1}}; -int CheckAnimFrameForEventType(animevent_t *animEvents, int keyFrame, animEventType_t eventType) { +int CheckAnimFrameForEventType(animevent_t *animEvents, int keyFrame, animEventType_e eventType) { int i; for (i = 0; i < MAX_ANIM_EVENTS; i++) { @@ -1561,7 +1561,7 @@ int CheckAnimFrameForEventType(animevent_t *animEvents, int keyFrame, animEventT void ParseAnimationEvtBlock(const char *aeb_filename, animevent_t *animEvents, animation_t *animations, int *i, const char **text_p) { const char *token; int num, n, animNum, keyFrame, lowestVal, highestVal, curAnimEvent, lastAnimEvent = 0; - animEventType_t eventType; + animEventType_e eventType; char stringData[MAX_QPATH]; // get past starting bracket @@ -1615,7 +1615,7 @@ void ParseAnimationEvtBlock(const char *aeb_filename, animevent_t *animEvents, a } token = COM_Parse(text_p); - eventType = (animEventType_t)GetIDForString(animEventTypeTable, token); + eventType = (animEventType_e)GetIDForString(animEventTypeTable, token); if (eventType == AEV_NONE || (signed)eventType == -1) { // Unrecognized ANIM EVENT TYOE, or we're skipping this line, keep going till you get a good one // Com_Printf(S_COLOR_YELLOW"WARNING: Unknown token %s in animEvent file %s\n", token, aeb_filename ); continue; @@ -1662,7 +1662,8 @@ void ParseAnimationEvtBlock(const char *aeb_filename, animevent_t *animEvents, a } else { animEvents[curAnimEvent].eventData[AED_SOUNDCHANNEL] = CHAN_AUTO; } - // fall through to normal sound + [[fallthrough]]; // to normal sound + case AEV_SOUND: //# animID AEV_SOUND framenum soundpath randomlow randomhi chancetoplay // get soundstring token = COM_Parse(text_p); diff --git a/game/bg_pmove.cpp b/game/bg_pmove.cpp index 1548c60..ff59c79 100644 --- a/game/bg_pmove.cpp +++ b/game/bg_pmove.cpp @@ -2186,7 +2186,7 @@ static qboolean PM_CheckJump(void) { } } } else { // in the air - animNumber_t legsAnim = (animNumber_t)pm->ps->legsAnim; + animNumber_e legsAnim = (animNumber_e)pm->ps->legsAnim; if (legsAnim == BOTH_WALL_RUN_LEFT || legsAnim == BOTH_WALL_RUN_RIGHT) { // running on a wall vector3 right, traceto, mins, maxs, fwdAngles; @@ -2201,7 +2201,7 @@ static qboolean PM_CheckJump(void) { if (legsAnim == BOTH_WALL_RUN_LEFT) { if (pm->ps->legsTimer > 400) { // not at the end of the anim - float animLen = PM_AnimLength(0, (animNumber_t)BOTH_WALL_RUN_LEFT); + float animLen = PM_AnimLength(0, (animNumber_e)BOTH_WALL_RUN_LEFT); if (pm->ps->legsTimer < animLen - 400) { // not at start of anim VectorMA(&pm->ps->origin, -16, &right, &traceto); anim = BOTH_WALL_RUN_LEFT_FLIP; @@ -2209,7 +2209,7 @@ static qboolean PM_CheckJump(void) { } } else if (legsAnim == BOTH_WALL_RUN_RIGHT) { if (pm->ps->legsTimer > 400) { // not at the end of the anim - float animLen = PM_AnimLength(0, (animNumber_t)BOTH_WALL_RUN_RIGHT); + float animLen = PM_AnimLength(0, (animNumber_e)BOTH_WALL_RUN_RIGHT); if (pm->ps->legsTimer < animLen - 400) { // not at start of anim VectorMA(&pm->ps->origin, 16, &right, &traceto); anim = BOTH_WALL_RUN_RIGHT_FLIP; @@ -2518,7 +2518,7 @@ static qboolean PM_CheckJump(void) { && ( BG_SaberInAttack( pm->ps->saberMove ) ) ) {//not in an anim we shouldn't interrupt //see if it's not too late to start a special jump-attack - float animLength = PM_AnimLength( 0, (animNumber_t)pm->ps->torsoAnim ); + float animLength = PM_AnimLength( 0, (animNumber_e)pm->ps->torsoAnim ); if ( animLength - pm->ps->torsoTimer < 500 ) {//just started the saberMove //check for special-case jump attacks @@ -5643,7 +5643,7 @@ void PM_VehicleWeaponAnimate(void) { if (pm->ps->torsoTimer > 0 && (pm->ps->torsoAnim == BOTH_VS_ATR_S || pm->ps->torsoAnim == BOTH_VS_ATL_S)) { /* //FIXME: no need to even call the PM_SetAnim at all in this case - Anim = (animNumber_t)pm->ps->torsoAnim; + Anim = (animNumber_e)pm->ps->torsoAnim; iFlags = SETANIM_FLAG_NORMAL; break; */ @@ -7013,7 +7013,7 @@ void BG_CmdForRoll(playerState_t *ps, int anim, usercmd_t *pCmd) { if (ps->torsoTimer <= 250) pCmd->forwardmove = pCmd->rightmove = 0; // beginning of anim - else if (PM_AnimLength(0, (animNumber_t)ps->legsAnim) - ps->torsoTimer < 350) + else if (PM_AnimLength(0, (animNumber_e)ps->legsAnim) - ps->torsoTimer < 350) pCmd->forwardmove = pCmd->rightmove = 0; else { // FIXME: ramp down over length of anim @@ -7028,7 +7028,7 @@ void BG_CmdForRoll(playerState_t *ps, int anim, usercmd_t *pCmd) { if (ps->torsoTimer <= 100) pCmd->forwardmove = pCmd->rightmove = 0; // beginning of anim - else if (PM_AnimLength(0, (animNumber_t)ps->legsAnim) - ps->torsoTimer < 200) + else if (PM_AnimLength(0, (animNumber_e)ps->legsAnim) - ps->torsoTimer < 200) pCmd->forwardmove = pCmd->rightmove = 0; else { // FIXME: ramp down over length of anim @@ -7043,7 +7043,7 @@ void BG_CmdForRoll(playerState_t *ps, int anim, usercmd_t *pCmd) { if (ps->torsoTimer <= 550) pCmd->forwardmove = pCmd->rightmove = 0; // beginning of anim - else if (PM_AnimLength(0, (animNumber_t)ps->legsAnim) - ps->torsoTimer < 150) + else if (PM_AnimLength(0, (animNumber_e)ps->legsAnim) - ps->torsoTimer < 150) pCmd->forwardmove = pCmd->rightmove = 0; else { pCmd->forwardmove = 64; @@ -8091,7 +8091,7 @@ static void PM_CmdForSaberMoves(usercmd_t *ucmd) { } } } else { // saberstaff attacks - aLen = PM_AnimLength(0, (animNumber_t)pm->ps->legsAnim); + aLen = PM_AnimLength(0, (animNumber_e)pm->ps->legsAnim); float lenMin = 1700.0f; float lenMax = 1800.0f; diff --git a/game/bg_public.h b/game/bg_public.h index 50909b0..5a7be16 100644 --- a/game/bg_public.h +++ b/game/bg_public.h @@ -138,7 +138,7 @@ Ghoul2 Insert End #error overflow: (CS_MAX) > MAX_CONFIGSTRINGS #endif -typedef enum legacyFixes_e { +enum legacyFixes_e { LEGACYFIX_SABERMOVEDATA = 0, /* m m ""# " m m @@ -152,9 +152,9 @@ typedef enum legacyFixes_e { Removal, replacement or adding of new flags might lead to incompatibilities Forks should define their own configstring or serverinfo cvar instead of modifying this */ -} legacyFixes_t; +}; -typedef enum { +enum g2ModelParts_t { G2_MODELPART_HEAD = 10, G2_MODELPART_WAIST, G2_MODELPART_LARM, @@ -162,7 +162,7 @@ typedef enum { G2_MODELPART_RHAND, G2_MODELPART_LLEG, G2_MODELPART_RLEG -} g2ModelParts_t; +}; #define G2_MODEL_PART 50 @@ -175,7 +175,7 @@ extern const char *bg_customSiegeSoundNames[MAX_CUSTOM_SIEGE_SOUNDS]; extern const char *bgToggleableSurfaces[BG_NUM_TOGGLEABLE_SURFACES]; extern const int bgToggleableSurfaceDebris[BG_NUM_TOGGLEABLE_SURFACES]; -typedef enum { +enum forceHandAnims_e { HANDEXTEND_NONE = 0, HANDEXTEND_FORCEPUSH, HANDEXTEND_FORCEPULL, @@ -196,14 +196,14 @@ typedef enum { HANDEXTEND_DRAGGING, HANDEXTEND_JEDITAUNT, -} forceHandAnims_t; +}; -typedef enum { BROKENLIMB_NONE = 0, BROKENLIMB_LARM, BROKENLIMB_RARM, NUM_BROKENLIMBS } brokenLimb_t; +enum brokenLimb_e { BROKENLIMB_NONE = 0, BROKENLIMB_LARM, BROKENLIMB_RARM, NUM_BROKENLIMBS }; // for supplier class items #define TOSS_DEBOUNCE_TIME 5000 -typedef enum gametype_e { +enum gametype_e { GT_FFA = 0, // free for all GT_HOLOCRON, // holocron ffa GT_JEDIMASTER, // jedi master @@ -216,7 +216,7 @@ typedef enum gametype_e { GT_CTF, // capture the flag GT_CTY, // capture the ysalimiri GT_MAX_GAME_TYPE -} gametype_t; +}; // gametype bits #define GTB_NONE (0x0000u) // invalid @@ -234,13 +234,13 @@ typedef enum gametype_e { #define GTB_CTY (0x0200u) // capture the ysalimiri #define GTB_ALL (0x03FFu) // all -typedef enum { GENDER_MALE, GENDER_FEMALE, GENDER_NEUTER } gender_t; +enum gender_e { GENDER_MALE, GENDER_FEMALE, GENDER_NEUTER }; extern const int forcePowerSorted[NUM_FORCE_POWERS]; -typedef enum saberLock_e { SABERLOCK_TOP, SABERLOCK_SIDE, SABERLOCK_LOCK, SABERLOCK_BREAK, SABERLOCK_SUPERBREAK, SABERLOCK_WIN, SABERLOCK_LOSE } saberLock_t; +enum saberLock_e { SABERLOCK_TOP, SABERLOCK_SIDE, SABERLOCK_LOCK, SABERLOCK_BREAK, SABERLOCK_SUPERBREAK, SABERLOCK_WIN, SABERLOCK_LOSE }; -typedef enum directions_e { DIR_RIGHT = 0, DIR_LEFT, DIR_FRONT, DIR_BACK, NUM_DIRECTIONS } directions_t; +enum directions_e { DIR_RIGHT = 0, DIR_LEFT, DIR_FRONT, DIR_BACK, NUM_DIRECTIONS }; // The pmove code takes a player_state_t and a usercmd_t and generates a new player_state_t and some other output data. // Used for local prediction on the client game and true movement on the server game. @@ -261,7 +261,7 @@ extern animation_t bgHumanoidAnimations[MAX_TOTALANIMATIONS]; #define MAX_ANIM_FILES 16 #define MAX_ANIM_EVENTS 300 -typedef enum { FOOTSTEP_R, FOOTSTEP_L, FOOTSTEP_HEAVY_R, FOOTSTEP_HEAVY_L, NUM_FOOTSTEP_TYPES } footstepType_t; +enum footstepType_e { FOOTSTEP_R, FOOTSTEP_L, FOOTSTEP_HEAVY_R, FOOTSTEP_HEAVY_L, NUM_FOOTSTEP_TYPES }; extern stringID_table_t animEventTypeTable[MAX_ANIM_EVENTS + 1]; extern stringID_table_t footstepTypeTable[NUM_FOOTSTEP_TYPES + 1]; @@ -300,7 +300,7 @@ extern stringID_table_t footstepTypeTable[NUM_FOOTSTEP_TYPES + 1]; #define AED_SABER_SPIN_TYPE 1 // 0 = saberspinoff, 1 = saberspin, 2-4 = saberspin1-saberspin3 #define AED_SABER_SPIN_PROBABILITY 2 -typedef enum { // NOTENOTE: Be sure to update animEventTypeTable and ParseAnimationEvtBlock(...) if you change this enum list! +enum animEventType_e { // NOTENOTE: Be sure to update animEventTypeTable and ParseAnimationEvtBlock(...) if you change this enum list! AEV_NONE, AEV_SOUND, //# animID AEV_SOUND framenum soundpath randomlow randomhi chancetoplay AEV_FOOTSTEP, //# animID AEV_FOOTSTEP framenum footstepType chancetoplay @@ -311,10 +311,10 @@ typedef enum { // NOTENOTE: Be sure to update animEventTypeTable and ParseAnima AEV_SABER_SWING, //# animID AEV_SABER_SWING framenum CHANNEL randomlow randomhi chancetoplay AEV_SABER_SPIN, //# animID AEV_SABER_SPIN framenum CHANNEL chancetoplay AEV_NUM_AEV -} animEventType_t; +}; typedef struct animevent_s { - animEventType_t eventType; + animEventType_e eventType; unsigned short keyFrame; // Frame to play event on signed short eventData[AED_ARRAY_SIZE]; // Unique IDs, can be soundIndex of sound file to play OR effect index or footstep type, etc. char *stringData; // we allow storage of one string, temporarily (in case we have to look up an index later, then make sure to set stringData to NULL so we @@ -349,7 +349,7 @@ extern bgLoadedEvents_t bgAllEvents[MAX_ANIM_FILES]; extern int bgNumAnimEvents; #endif -typedef enum { +enum pmtype_e { PM_NORMAL, // can accelerate and turn PM_JETPACK, // special jetpack movement PM_FLOAT, // float with no gravity in general direction of velocity (intended for gripping) @@ -359,9 +359,9 @@ typedef enum { PM_FREEZE, // stuck in place with no control PM_INTERMISSION, // no movement or status bar PM_SPINTERMISSION // no movement or status bar -} pmtype_t; +}; -typedef enum { +enum weaponstate_e { WEAPON_READY, WEAPON_RAISING, WEAPON_DROPPING, @@ -369,9 +369,9 @@ typedef enum { WEAPON_CHARGING, WEAPON_CHARGING_ALT, WEAPON_IDLE, // lowered // NOTENOTE Added with saber -} weaponstate_t; +}; -typedef enum forceMasteries_e { +enum forceMasteries_e { FORCE_MASTERY_UNINITIATED, FORCE_MASTERY_INITIATE, FORCE_MASTERY_PADAWAN, @@ -381,7 +381,7 @@ typedef enum forceMasteries_e { FORCE_MASTERY_JEDI_KNIGHT, FORCE_MASTERY_JEDI_MASTER, NUM_FORCE_MASTERY_LEVELS -} forceMasteries_t; +}; extern const char *forceMasteryLevels[NUM_FORCE_MASTERY_LEVELS]; extern const int forceMasteryPoints[NUM_FORCE_MASTERY_LEVELS]; @@ -505,7 +505,7 @@ extern pmove_t *pm; // player_state->stats[] indexes // NOTE: may not have more than 16 -typedef enum { +enum statIndex_e { STAT_HEALTH, STAT_HOLDABLE_ITEM, STAT_HOLDABLE_ITEMS, @@ -518,13 +518,13 @@ typedef enum { STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?) STAT_MAX_HEALTH, // health / armor limit, changable by handicap STAT_JUMPTIME -} statIndex_t; +}; // player_state->persistant[] indexes // these fields are the only part of player_state that isn't // cleared on respawn // NOTE: may not have more than 16 -typedef enum { +enum persEnum_e { PERS_SCORE, // !!! MUST NOT CHANGE, SERVER AND GAME BOTH REFERENCE !!! PERS_HITS, // total points damage inflicted so damage beeps can sound on change PERS_RANK, // player rank or team rank @@ -541,7 +541,7 @@ typedef enum { PERS_ASSIST_COUNT, // assist awards PERS_GAUNTLET_FRAG_COUNT, // kills with the guantlet PERS_CAPTURES // captures -} persEnum_t; +}; // entityState_t->eFlags #define EF_G2ANIMATING (0x00000001u) // perform g2 bone anims based on torsoAnim and legsAnim, works for ET_GENERAL -rww @@ -592,7 +592,7 @@ typedef enum { #define EF2_NOT_USED_1 (0x0100u) // #define EF2_GRAPPLE_OUT (0x0200u) // grapple hook is out -typedef enum { +enum effectTypes_e { EFFECT_NONE = 0, EFFECT_SMOKE, EFFECT_EXPLOSION, @@ -614,10 +614,10 @@ typedef enum { EFFECT_LANDING_SNOW, EFFECT_LANDING_GRAVEL, EFFECT_MAX -} effectTypes_t; +}; // NOTE: may not have more than 16 -typedef enum powerup_e { +enum powerup_e { PW_NONE, PW_QUAD, @@ -648,9 +648,9 @@ typedef enum powerup_e { PW_NUM_POWERUPS -} powerup_t; +}; -typedef enum holdable_e { +enum holdable_e { HI_NONE = 0, HI_SEEKER, HI_SHIELD, @@ -664,15 +664,15 @@ typedef enum holdable_e { HI_EWEB, HI_CLOAK, HI_NUM_HOLDABLE -} holdable_t; +}; -typedef enum ctfMsg_e { +enum ctfMsg_e { CTFMESSAGE_FRAGGED_FLAG_CARRIER, CTFMESSAGE_FLAG_RETURNED, CTFMESSAGE_PLAYER_RETURNED_FLAG, CTFMESSAGE_PLAYER_CAPTURED_FLAG, CTFMESSAGE_PLAYER_GOT_FLAG -} ctfMsg_t; +}; // reward sounds (stored in ps->persistant[PERS_PLAYEREVENTS]) #define PLAYEREVENT_DENIEDREWARD (0x0001u) @@ -694,9 +694,9 @@ typedef enum ctfMsg_e { #define EVENT_VALID_MSEC 300 -typedef enum { PDSOUND_NONE, PDSOUND_PROTECTHIT, PDSOUND_PROTECT, PDSOUND_ABSORBHIT, PDSOUND_ABSORB, PDSOUND_FORCEJUMP, PDSOUND_FORCEGRIP } pdSounds_t; +enum pdSounds_e { PDSOUND_NONE, PDSOUND_PROTECTHIT, PDSOUND_PROTECT, PDSOUND_ABSORBHIT, PDSOUND_ABSORB, PDSOUND_FORCEJUMP, PDSOUND_FORCEGRIP }; -typedef enum { +enum entity_event_e { EV_NONE, EV_CLIENTJOIN, @@ -942,10 +942,9 @@ typedef enum { EV_SIEGESPEC, EV_NUM_ENTITY_EVENTS +}; // There is a maximum of 256 events (8 bits transmission, 2 high bits for uniqueness) -} entity_event_t; // There is a maximum of 256 events (8 bits transmission, 2 high bits for uniqueness) - -typedef enum { +enum global_team_sound_e { GTS_RED_CAPTURE, GTS_BLUE_CAPTURE, GTS_RED_RETURN, @@ -957,24 +956,24 @@ typedef enum { GTS_REDTEAM_TOOK_LEAD, GTS_BLUETEAM_TOOK_LEAD, GTS_TEAMS_ARE_TIED -} global_team_sound_t; +}; -typedef enum team_e { +enum team_e { TEAM_FREE, TEAM_RED, TEAM_BLUE, TEAM_SPECTATOR, TEAM_NUM_TEAMS -} team_t; +}; -typedef enum { +enum duelTeam_e { DUELTEAM_FREE, DUELTEAM_LONE, DUELTEAM_DOUBLE, DUELTEAM_SINGLE, // for regular duel matches (not power duel) -} duelTeam_t; +}; // Time between location updates #define TEAM_LOCATION_UPDATE_TIME 1000 @@ -983,19 +982,10 @@ typedef enum { #define TEAM_MAXOVERLAY 32 // team task -typedef enum { - TEAMTASK_NONE, - TEAMTASK_OFFENSE, - TEAMTASK_DEFENSE, - TEAMTASK_PATROL, - TEAMTASK_FOLLOW, - TEAMTASK_RETRIEVE, - TEAMTASK_ESCORT, - TEAMTASK_CAMP -} teamtask_t; +enum teamtask_e { TEAMTASK_NONE, TEAMTASK_OFFENSE, TEAMTASK_DEFENSE, TEAMTASK_PATROL, TEAMTASK_FOLLOW, TEAMTASK_RETRIEVE, TEAMTASK_ESCORT, TEAMTASK_CAMP }; // means of death -typedef enum { +enum meansOfDeath_e { MOD_UNKNOWN, MOD_STUN_BATON, MOD_MELEE, @@ -1046,10 +1036,10 @@ typedef enum { // or suiciding, and so you would actually be giving him a point) -Rich // I put it back in for now, if it becomes a problem we'll work around it later (it shouldn't though)... MOD_MAX -} meansOfDeath_t; +}; // gitem_t->type -typedef enum itemType_e { +enum itemType_e { IT_BAD, IT_WEAPON, // EFX: rotate + upscale + minlight IT_AMMO, // EFX: rotate @@ -1061,7 +1051,7 @@ typedef enum itemType_e { // EFX: rotate + bob IT_PERSISTANT_POWERUP, IT_TEAM -} itemType_t; +}; #define MAX_ITEM_MODELS 3 @@ -1070,7 +1060,7 @@ typedef struct gitem_s { const char *pickup_sound; const char *icon; int quantity; // for ammo how much, or duration of powerup - itemType_t giType; // IT_* flags + itemType_e giType; // IT_* flags int giTag; const char *view_model, *world_model[MAX_ITEM_MODELS]; const char *precaches, *sounds; @@ -1119,7 +1109,7 @@ extern const size_t bg_numItems; // // entityState_t->eType // -typedef enum entityType_s { +enum entityType_e { ET_GENERAL, ET_PLAYER, ET_ITEM, @@ -1143,7 +1133,7 @@ typedef enum entityType_s { // by setting eType to ET_EVENTS + eventNum // this avoids having to set eFlags and eventNum ET_MAX -} entityType_t; +}; extern const stringID_table_t eTypes[ET_MAX]; // @@ -1153,7 +1143,7 @@ extern const stringID_table_t eTypes[ET_MAX]; #if defined(PROJECT_GAME) || defined(PROJECT_CGAME) -typedef enum { +enum fieldtype_t { F_INT, F_FLOAT, F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL @@ -1179,7 +1169,7 @@ typedef enum { F_PARM15, // Special case for parms F_PARM16, // Special case for parms F_IGNORE -} fieldtype_t; +}; typedef struct BG_field_s { const char *name; @@ -1189,7 +1179,7 @@ typedef struct BG_field_s { #endif -typedef enum tauntTypes_e { TAUNT_TAUNT = 0, TAUNT_BOW, TAUNT_MEDITATE, TAUNT_FLOURISH, TAUNT_GLOAT } tauntTypes_t; +enum tauntTypes_e { TAUNT_TAUNT = 0, TAUNT_BOW, TAUNT_MEDITATE, TAUNT_FLOURISH, TAUNT_GLOAT }; // Okay, here lies the much-dreaded Pat-created FSM movement chart... Heretic II strikes again! // Why am I inflicting this on you? Well, it's better than hardcoded states. @@ -1202,7 +1192,7 @@ typedef enum tauntTypes_e { TAUNT_TAUNT = 0, TAUNT_BOW, TAUNT_MEDITATE, TAUNT_FL #undef LS_NONE #endif -typedef enum saberMoveName_e { +enum saberMoveName_e { // totally invalid LS_INVALID = -1, // Invalid, or saber not armed @@ -1401,9 +1391,9 @@ typedef enum saberMoveName_e { LS_JAPLUS_NEWANIM_FLIPSABERSTAB, LS_MOVE_MAX // -} saberMoveName_t; +}; -typedef enum saberQuadrant_e { Q_BR, Q_R, Q_TR, Q_T, Q_TL, Q_L, Q_BL, Q_B, Q_NUM_QUADS } saberQuadrant_t; +enum saberQuadrant_e { Q_BR, Q_R, Q_TR, Q_T, Q_TL, Q_L, Q_BL, Q_B, Q_NUM_QUADS }; typedef struct saberMoveData_s { const char *name; @@ -1413,13 +1403,13 @@ typedef struct saberMoveData_s { uint32_t animSetFlags; int blendTime; int blocking; - saberMoveName_t chain_idle; // What move to call if the attack button is not pressed at the end of this anim - saberMoveName_t chain_attack; // What move to call if the attack button (and nothing else) is pressed + saberMoveName_e chain_idle; // What move to call if the attack button is not pressed at the end of this anim + saberMoveName_e chain_attack; // What move to call if the attack button (and nothing else) is pressed qboolean trailLength; } saberMoveData_t; extern saberMoveData_t saberMoveData[LS_MOVE_MAX]; -typedef enum saberType_e { +enum saberType_e { SABER_NONE = 0, SABER_SINGLE, SABER_STAFF, @@ -1434,7 +1424,7 @@ typedef enum saberType_e { SABER_TRIDENT, SABER_SITH_SWORD, NUM_SABERS -} saberType_t; +}; typedef struct saberTrail_s { // Actual trail stuff @@ -1466,7 +1456,7 @@ typedef struct bladeInfo_s { } bladeInfo_t; #define MAX_BLADES 8 -typedef enum saber_styles_e { SS_NONE = 0, SS_FAST, SS_MEDIUM, SS_STRONG, SS_DESANN, SS_TAVION, SS_DUAL, SS_STAFF, SS_NUM_SABER_STYLES } saber_styles_t; +enum saber_styles_e { SS_NONE = 0, SS_FAST, SS_MEDIUM, SS_STRONG, SS_DESANN, SS_TAVION, SS_DUAL, SS_STAFF, SS_NUM_SABER_STYLES }; // SABER FLAGS #define SFL_NOT_LOCKABLE (0x00000001u) // can't get into a saberlock @@ -1517,7 +1507,7 @@ typedef enum saber_styles_e { SS_NONE = 0, SS_FAST, SS_MEDIUM, SS_STRONG, SS_DES typedef struct saberInfo_s { char name[SABER_NAME_LENGTH]; // entry in sabers.cfg, if any char fullName[SABER_NAME_LENGTH]; // the "Proper Name" of the saber, shown in UI - saberType_t type; // none, single or staff + saberType_e type; // none, single or staff char model[MAX_QPATH]; // hilt model qhandle_t skin; // registered skin id int soundOn; // game soundindex for turning on sound @@ -1534,7 +1524,7 @@ typedef struct saberInfo_s { int parryBonus; // added to strength of parry with this saber int breakParryBonus, breakParryBonus2; // added to strength when hit a parry int disarmBonus, disarmBonus2; // added to disarm chance when win saberlock or have a good parry (knockaway) - saber_styles_t singleBladeStyle; // makes it so that you use a different style if you only have the first blade active + saber_styles_e singleBladeStyle; // makes it so that you use a different style if you only have the first blade active // these values are global to the saber, like all of the ones above uint32_t saberFlags, saberFlags2; // from SFL(2)_ list above @@ -1621,7 +1611,7 @@ extern const char *gametypeStringShort[GT_MAX_GAME_TYPE]; void *BG_Alloc(int size); void *BG_AllocUnaligned(int size); void BG_AddPredictableEventToPlayerstate(int newEvent, int eventParm, playerState_t *ps); -int BG_AnimLength(int index, animNumber_t anim); +int BG_AnimLength(int index, animNumber_e anim); void BG_AttachToRancor(void *ghoul2, float rancYaw, vector3 *rancOrigin, int time, qhandle_t *modelList, vector3 *modelScale, qboolean inMouth, vector3 *out_origin, vector3 *out_angles, vector3 out_axis[3]); void BG_BLADE_ActivateTrail(bladeInfo_t *blade, float duration); @@ -1636,10 +1626,10 @@ qboolean BG_DirectFlippingAnim(int anim); void BG_EvaluateTrajectory(const trajectory_t *tr, int atTime, vector3 *result); void BG_EvaluateTrajectoryDelta(const trajectory_t *tr, int atTime, vector3 *result); const gitem_t *BG_FindItem(const char *classname); -const gitem_t *BG_FindItemForAmmo(ammo_t ammo); -const gitem_t *BG_FindItemForHoldable(holdable_t hi); -const gitem_t *BG_FindItemForPowerup(powerup_t pw); -const gitem_t *BG_FindItemForWeapon(weapon_t wp); +const gitem_t *BG_FindItemForAmmo(ammo_e ammo); +const gitem_t *BG_FindItemForHoldable(holdable_e hi); +const gitem_t *BG_FindItemForPowerup(powerup_e pw); +const gitem_t *BG_FindItemForWeapon(weapon_e wp); void BG_FixSaberMoveData(void); qboolean BG_FlippingAnim(int anim); void BG_ForcePowerDrain(playerState_t *ps, forcePowers_t forcePower, int overrideAmt); @@ -1650,10 +1640,10 @@ void BG_G2PlayerAngles(void *ghoul2, int motionBolt, entityState_t *cent, int ti vector3 *lastHeadAngles, int lookTime, entityState_t *emplaced, int *crazySmoothFactor); int BG_GetGametypeForString(const char *gametype); const char *BG_GetGametypeString(int gametype); -int BG_GetItemIndexByTag(int tag, itemType_t type); +int BG_GetItemIndexByTag(int tag, itemType_e type); float BG_GetLegsAnimPoint(playerState_t *ps, int AnimIndex); uint32_t BG_GetMapTypeBits(const char *type); -team_t BG_GetOpposingTeam(team_t team); +team_e BG_GetOpposingTeam(team_e team); float BG_GetTorsoAnimPoint(playerState_t *ps, int AnimIndex); void BG_GiveMeVectorFromMatrix(mdxaBone_t *boltMatrix, uint32_t flags, vector3 *vec); qboolean BG_HasAnimation(int animIndex, int animation); diff --git a/game/bg_saber.cpp b/game/bg_saber.cpp index 70c3058..9b3fe14 100644 --- a/game/bg_saber.cpp +++ b/game/bg_saber.cpp @@ -363,7 +363,7 @@ int transitionMove[Q_NUM_QUADS][Q_NUM_QUADS] = { {LS_T1_BL_BR, LS_T1_BR__R, LS_T1_BR_TR, LS_T1_BR_T_, LS_T1_BR_TL, LS_T1_BR__L, LS_T1_BR_BL, LS_NONE}, }; -saberMoveName_t PM_AttackMoveForQuad(int quad) { +saberMoveName_e PM_AttackMoveForQuad(int quad) { switch (quad) { case Q_B: case Q_BR: @@ -519,7 +519,7 @@ int PM_SaberAnimTransitionAnim(int curmove, int newmove) { return retmove; } -saberMoveName_t PM_CheckStabDown(void) { +saberMoveName_e PM_CheckStabDown(void) { vector3 faceFwd, facingAngles; vector3 fwd; bgEntity_t *ent = NULL; @@ -1287,7 +1287,7 @@ qboolean PM_CanBackstab(void) { return qfalse; } -saberMoveName_t PM_SaberFlipOverAttackMove(void) { +saberMoveName_e PM_SaberFlipOverAttackMove(void) { vector3 fwdAngles, jumpFwd; float jumpDistance = GetCInfo(CINFO_YELLOWDFA) ? 50.0f : 150.0f; // float zDiff = 0; @@ -1299,12 +1299,12 @@ saberMoveName_t PM_SaberFlipOverAttackMove(void) { // see if we have an overridden (or cancelled) lunge move if (saber1 && saber1->jumpAtkFwdMove != LS_INVALID) { if (saber1->jumpAtkFwdMove != LS_NONE) { - return (saberMoveName_t)saber1->jumpAtkFwdMove; + return (saberMoveName_e)saber1->jumpAtkFwdMove; } } if (saber2 && saber2->jumpAtkFwdMove != LS_INVALID) { if (saber2->jumpAtkFwdMove != LS_NONE) { - return (saberMoveName_t)saber2->jumpAtkFwdMove; + return (saberMoveName_e)saber2->jumpAtkFwdMove; } } // no overrides, cancelled? @@ -1379,12 +1379,12 @@ int PM_SaberBackflipAttackMove(void) { // see if we have an overridden (or cancelled) lunge move if (saber1 && saber1->jumpAtkBackMove != LS_INVALID) { if (saber1->jumpAtkBackMove != LS_NONE) { - return (saberMoveName_t)saber1->jumpAtkBackMove; + return (saberMoveName_e)saber1->jumpAtkBackMove; } } if (saber2 && saber2->jumpAtkBackMove != LS_INVALID) { if (saber2->jumpAtkBackMove != LS_NONE) { - return (saberMoveName_t)saber2->jumpAtkBackMove; + return (saberMoveName_e)saber2->jumpAtkBackMove; } } // no overrides, cancelled? @@ -1438,19 +1438,19 @@ qboolean PM_SomeoneInFront(trace_t *tr) { // Also a very simplified version of t return qfalse; } -saberMoveName_t PM_SaberLungeAttackMove(qboolean noSpecials) { +saberMoveName_e PM_SaberLungeAttackMove(qboolean noSpecials) { vector3 fwdAngles, jumpFwd; saberInfo_t *saber1 = BG_MySaber(pm->ps->clientNum, 0); saberInfo_t *saber2 = BG_MySaber(pm->ps->clientNum, 1); // see if we have an overridden (or cancelled) lunge move if (saber1 && saber1->lungeAtkMove != LS_INVALID) { if (saber1->lungeAtkMove != LS_NONE) { - return (saberMoveName_t)saber1->lungeAtkMove; + return (saberMoveName_e)saber1->lungeAtkMove; } } if (saber2 && saber2->lungeAtkMove != LS_INVALID) { if (saber2->lungeAtkMove != LS_NONE) { - return (saberMoveName_t)saber2->lungeAtkMove; + return (saberMoveName_e)saber2->lungeAtkMove; } } // no overrides, cancelled? @@ -1478,18 +1478,18 @@ saberMoveName_t PM_SaberLungeAttackMove(qboolean noSpecials) { return LS_A_T2B; } -saberMoveName_t PM_SaberJumpAttackMove2(void) { +saberMoveName_e PM_SaberJumpAttackMove2(void) { saberInfo_t *saber1 = BG_MySaber(pm->ps->clientNum, 0); saberInfo_t *saber2 = BG_MySaber(pm->ps->clientNum, 1); // see if we have an overridden (or cancelled) lunge move if (saber1 && saber1->jumpAtkFwdMove != LS_INVALID) { if (saber1->jumpAtkFwdMove != LS_NONE) { - return (saberMoveName_t)saber1->jumpAtkFwdMove; + return (saberMoveName_e)saber1->jumpAtkFwdMove; } } if (saber2 && saber2->jumpAtkFwdMove != LS_INVALID) { if (saber2->jumpAtkFwdMove != LS_NONE) { - return (saberMoveName_t)saber2->jumpAtkFwdMove; + return (saberMoveName_e)saber2->jumpAtkFwdMove; } } // no overrides, cancelled? @@ -1499,13 +1499,13 @@ saberMoveName_t PM_SaberJumpAttackMove2(void) { return LS_A_T2B; // LS_NONE; // just do it if (pm->ps->fd.saberAnimLevel == SS_DUAL) - return (saberMoveName_t)PM_SaberDualJumpAttackMove(); + return (saberMoveName_e)PM_SaberDualJumpAttackMove(); else return LS_JUMPATTACK_STAFF_RIGHT; // return LS_A_T2B; } -saberMoveName_t PM_SaberJumpAttackMove(void) { +saberMoveName_e PM_SaberJumpAttackMove(void) { vector3 fwdAngles, jumpFwd; saberInfo_t *saber1 = BG_MySaber(pm->ps->clientNum, 0); saberInfo_t *saber2 = BG_MySaber(pm->ps->clientNum, 1); @@ -1513,12 +1513,12 @@ saberMoveName_t PM_SaberJumpAttackMove(void) { // see if we have an overridden (or cancelled) lunge move if (saber1 && saber1->jumpAtkFwdMove != LS_INVALID) { if (saber1->jumpAtkFwdMove != LS_NONE) { - return (saberMoveName_t)saber1->jumpAtkFwdMove; + return (saberMoveName_e)saber1->jumpAtkFwdMove; } } if (saber2 && saber2->jumpAtkFwdMove != LS_INVALID) { if (saber2->jumpAtkFwdMove != LS_NONE) { - return (saberMoveName_t)saber2->jumpAtkFwdMove; + return (saberMoveName_e)saber2->jumpAtkFwdMove; } } @@ -1659,7 +1659,7 @@ static qboolean PM_CheckEnemyPresence(int dir, float radius) { // anyone in this #define SABER_ALT_ATTACK_POWER_FB 25 // 30/50? qboolean PM_SaberInReturn(int move); // bg_panimate.c -saberMoveName_t PM_CheckPullAttack(void) { +saberMoveName_e PM_CheckPullAttack(void) { #if 0 // disabling these for MP, they aren't useful if (!(pm->cmd.buttons & BUTTON_ATTACK)) { @@ -1684,7 +1684,7 @@ saberMoveName_t PM_CheckPullAttack(void) { // if ( g_saberNewControlScheme->integer // || g_crosshairEntNum < ENTITYNUM_WORLD )//in old control scheme, there has to be someone there { - saberMoveName_t pullAttackMove = LS_NONE; + saberMoveName_e pullAttackMove = LS_NONE; if ( pm->ps->fd.saberAnimLevel == SS_FAST ) pullAttackMove = LS_PULL_ATTACK_STAB; else @@ -1719,12 +1719,12 @@ static qboolean PM_KataDisabled(void) { return GetCInfo(CINFO_NOKATA) || (GetCPD static qboolean PM_StabDisabled(void) { return GetCInfo(CINFO_NOSTAB) || (GetCPD(pm_entSelf, CPD_NOSTAB) && GetCInfo(CINFO_NOSTAB)); } -static saberMoveName_t PM_SaberAttackForMovement(saberMoveName_t curmove) { - saberMoveName_t newmove = LS_NONE; +static saberMoveName_e PM_SaberAttackForMovement(saberMoveName_e curmove) { + saberMoveName_e newmove = LS_NONE; qboolean noSpecials = PM_InSecondaryStyle(); qboolean allowCartwheels = qtrue; - saberMoveName_t overrideJumpRightAttackMove = LS_INVALID; - saberMoveName_t overrideJumpLeftAttackMove = LS_INVALID; + saberMoveName_e overrideJumpRightAttackMove = LS_INVALID; + saberMoveName_e overrideJumpLeftAttackMove = LS_INVALID; if (pm->ps->weapon == WP_SABER) { saberInfo_t *saber1 = BG_MySaber(pm->ps->clientNum, 0); @@ -1733,32 +1733,32 @@ static saberMoveName_t PM_SaberAttackForMovement(saberMoveName_t curmove) { if (saber1 && saber1->jumpAtkRightMove != LS_INVALID) { if (saber1->jumpAtkRightMove != LS_NONE) { // actually overriding - overrideJumpRightAttackMove = (saberMoveName_t)saber1->jumpAtkRightMove; + overrideJumpRightAttackMove = (saberMoveName_e)saber1->jumpAtkRightMove; } else if (saber2 && saber2->jumpAtkRightMove > LS_NONE) { // would be cancelling it, but check the second saber, too - overrideJumpRightAttackMove = (saberMoveName_t)saber2->jumpAtkRightMove; + overrideJumpRightAttackMove = (saberMoveName_e)saber2->jumpAtkRightMove; } else { // nope, just cancel it overrideJumpRightAttackMove = LS_NONE; } } else if (saber2 && saber2->jumpAtkRightMove != LS_INVALID) { // first saber not overridden, check second - overrideJumpRightAttackMove = (saberMoveName_t)saber2->jumpAtkRightMove; + overrideJumpRightAttackMove = (saberMoveName_e)saber2->jumpAtkRightMove; } if (saber1 && saber1->jumpAtkLeftMove != LS_INVALID) { if (saber1->jumpAtkLeftMove != LS_NONE) { // actually overriding - overrideJumpLeftAttackMove = (saberMoveName_t)saber1->jumpAtkLeftMove; + overrideJumpLeftAttackMove = (saberMoveName_e)saber1->jumpAtkLeftMove; } else if (saber2 && saber2->jumpAtkLeftMove > LS_NONE) { // would be cancelling it, but check the second saber, too - overrideJumpLeftAttackMove = (saberMoveName_t)saber2->jumpAtkLeftMove; + overrideJumpLeftAttackMove = (saberMoveName_e)saber2->jumpAtkLeftMove; } else { // nope, just cancel it overrideJumpLeftAttackMove = LS_NONE; } } else if (saber2 && saber2->jumpAtkLeftMove != LS_INVALID) { // first saber not overridden, check second - overrideJumpLeftAttackMove = (saberMoveName_t)saber1->jumpAtkLeftMove; + overrideJumpLeftAttackMove = (saberMoveName_e)saber1->jumpAtkLeftMove; } if (saber1 && (saber1->saberFlags & SFL_NO_CARTWHEELS)) { @@ -1914,7 +1914,7 @@ static saberMoveName_t PM_SaberAttackForMovement(saberMoveName_t curmove) { BG_ForcePowerDrain(pm->ps, FP_GRIP, SABER_ALT_ATTACK_POWER_FB); } } else if (!noSpecials) { - saberMoveName_t stabDownMove = PM_CheckStabDown(); + saberMoveName_e stabDownMove = PM_CheckStabDown(); if (stabDownMove != LS_NONE && BG_EnoughForcePowerForMove(SABER_ALT_ATTACK_POWER_FB)) { newmove = stabDownMove; BG_ForcePowerDrain(pm->ps, FP_GRIP, SABER_ALT_ATTACK_POWER_FB); @@ -1931,7 +1931,7 @@ static saberMoveName_t PM_SaberAttackForMovement(saberMoveName_t curmove) { pm->ps->velocity.z >= 0 && (pm->cmd.upmove > 0 || pm->ps->pm_flags & PMF_JUMP_HELD) && !BG_SaberInTransitionAny(pm->ps->saberMove) && !BG_SaberInAttack(pm->ps->saberMove) && pm->ps->weaponTime <= 0 && pm->ps->forceHandExtend == HANDEXTEND_NONE && (pm->cmd.buttons & BUTTON_ATTACK)) { // BACKFLIP ATTACK - newmove = (saberMoveName_t)PM_SaberBackflipAttackMove(); + newmove = (saberMoveName_e)PM_SaberBackflipAttackMove(); } // backstab else if (!PM_StabDisabled() && PM_CanBackstab() && !BG_SaberInSpecialAttack(pm->ps->torsoAnim)) { // BACKSTAB (attack varies by level) @@ -2414,7 +2414,7 @@ void PM_WeaponLightsaber(void) { // make weapon function if (pm->ps->weaponTime > 0) { // check for special pull move while busy - saberMoveName_t pullmove = PM_CheckPullAttack(); + saberMoveName_e pullmove = PM_CheckPullAttack(); if (pullmove != LS_NONE) { pm->ps->weaponTime = 0; pm->ps->torsoTimer = 0; @@ -2497,7 +2497,7 @@ void PM_WeaponLightsaber(void) { } } } else { // start the bounce - bounceMove = PM_SaberBounceForAttack((saberMoveName_t)pm->ps->saberMove); + bounceMove = PM_SaberBounceForAttack((saberMoveName_e)pm->ps->saberMove); } PM_SetSaberMove(bounceMove); @@ -2577,19 +2577,19 @@ void PM_WeaponLightsaber(void) { } if (PM_CanDoKata()) { - saberMoveName_t overrideMove = LS_INVALID; + saberMoveName_e overrideMove = LS_INVALID; saberInfo_t *saber1 = BG_MySaber(pm->ps->clientNum, 0); saberInfo_t *saber2 = BG_MySaber(pm->ps->clientNum, 1); // see if we have an overridden (or cancelled) kata move if (saber1 && saber1->kataMove != LS_INVALID) { if (saber1->kataMove != LS_NONE) { - overrideMove = (saberMoveName_t)saber1->kataMove; + overrideMove = (saberMoveName_e)saber1->kataMove; } } if (overrideMove == LS_INVALID) { // not overridden by first saber, check second if (saber2 && saber2->kataMove != LS_INVALID) { if (saber2->kataMove != LS_NONE) { - overrideMove = (saberMoveName_t)saber2->kataMove; + overrideMove = (saberMoveName_e)saber2->kataMove; } } } @@ -2843,7 +2843,7 @@ void PM_WeaponLightsaber(void) { newmove = saberMoveData[curmove].chain_idle; } else */ - newmove = PM_SaberAttackForMovement((saberMoveName_t)curmove); + newmove = PM_SaberAttackForMovement((saberMoveName_e)curmove); if ((PM_SaberInBounce(curmove) || PM_SaberInBrokenParry(curmove)) && saberMoveData[newmove].startQuad == saberMoveData[curmove].endQuad) { // this attack would be a repeat of the last (which was blocked), so don't actually use it, // use the default chain attack for this bounce diff --git a/game/bg_saberLoad.cpp b/game/bg_saberLoad.cpp index c579281..2650a9c 100644 --- a/game/bg_saberLoad.cpp +++ b/game/bg_saberLoad.cpp @@ -190,7 +190,7 @@ saber_colors_t TranslateSaberColor(const char *name) { return SABER_BLUE; } -saber_styles_t TranslateSaberStyle(const char *name) { +saber_styles_e TranslateSaberStyle(const char *name) { if (!Q_stricmp(name, "fast")) return SS_FAST; else if (!Q_stricmp(name, "medium")) @@ -209,7 +209,7 @@ saber_styles_t TranslateSaberStyle(const char *name) { return SS_NONE; } -saberType_t TranslateSaberType(const char *name) { +saberType_e TranslateSaberType(const char *name) { if (!Q_stricmp(name, "SABER_SINGLE")) return SABER_SINGLE; if (!Q_stricmp(name, "SABER_STAFF")) @@ -468,7 +468,7 @@ void WP_SaberSetDefaults(saberInfo_t *saber) { saber->gloatAnim = -1; // -1 - anim to use when hit "gloat" //***NOTE: you can only have a maximum of 2 "styles" of blades, so this next value, "bladeStyle2Start" is the number of the first blade to use these value - //on... all blades before this use the normal values above, all blades at and after this number use the secondary values below*** + // on... all blades before this use the normal values above, all blades at and after this number use the secondary values below*** saber->bladeStyle2Start = 0; // 0 - if set, blades from this number and higher use the following values (otherwise, they use the normal values already set) //***The following can be different for the extra blades - not setting them individually defaults them to the value for the whole saber (and first blade)*** @@ -545,7 +545,7 @@ static void Saber_ParseSaberType(saberInfo_t *saber, const char **p) { return; saberType = GetIDForString(saberTable, value); if (saberType >= SABER_SINGLE && saberType <= NUM_SABERS) - saber->type = (saberType_t)saberType; + saber->type = (saberType_e)saberType; } static void Saber_ParseSaberModel(saberInfo_t *saber, const char **p) { const char *value; diff --git a/game/bg_saga.h b/game/bg_saga.h index 76fb69d..ee938cb 100644 --- a/game/bg_saga.h +++ b/game/bg_saga.h @@ -19,9 +19,9 @@ #define MAX_EXDATA_ENTS_TO_SEND MAX_CLIENTS // max number of extended data for ents to send // The basic siege player classes -typedef enum { SPC_INFANTRY = 0, SPC_VANGUARD, SPC_SUPPORT, SPC_JEDI, SPC_DEMOLITIONIST, SPC_HEAVY_WEAPONS, SPC_MAX } siegePlayerClassFlags_t; +enum siegePlayerClassFlags_e { SPC_INFANTRY = 0, SPC_VANGUARD, SPC_SUPPORT, SPC_JEDI, SPC_DEMOLITIONIST, SPC_HEAVY_WEAPONS, SPC_MAX }; -typedef enum { +enum siegeClassFlags_e { CFL_MORESABERDMG = 0, CFL_STRONGAGAINSTPHYSICAL, CFL_FASTFORCEREGEN, @@ -30,7 +30,7 @@ typedef enum { CFL_SINGLE_ROCKET, // has only 1 rocket to use with rocketlauncher CFL_CUSTOMSKEL, // class uses a custom skeleton, be sure to load on server etc CFL_EXTRA_AMMO -} siegeClassFlags_t; +}; #define SIEGE_CLASS_DESC_LEN 4096 typedef struct siegeClassDesc_s { diff --git a/game/bg_vehicleLoad.cpp b/game/bg_vehicleLoad.cpp index c09fe9f..d6b3fe6 100644 --- a/game/bg_vehicleLoad.cpp +++ b/game/bg_vehicleLoad.cpp @@ -43,7 +43,7 @@ int numVehicles = 0; // first one is null/default void BG_VehicleLoadParms(void); -typedef enum { +enum vehFieldType_e { VF_IGNORE, VF_INT, VF_FLOAT, @@ -61,12 +61,12 @@ typedef enum { VF_SHADER_NOMIP, // (cgame only) take the string, call trap->R_RegisterShaderNoMip VF_SOUND, // take the string, get the G_SoundIndex VF_SOUND_CLIENT // (cgame only) take the string, get the index -} vehFieldType_t; +}; typedef struct { const char *name; size_t ofs; - vehFieldType_t type; + vehFieldType_e type; } vehField_t; const vehField_t vehWeaponFields[NUM_VWEAP_PARMS] = { @@ -104,7 +104,7 @@ static qboolean BG_ParseVehWeaponParm(vehWeaponInfo_t *vehWeapon, char *parmName vector3 vec; byte *b = (byte *)vehWeapon; int _iFieldsRead = 0; - vehicleType_t vehType; + vehicleType_e vehType; char value[1024]; Q_strncpyz(value, pValue, sizeof(value)); @@ -141,8 +141,8 @@ static qboolean BG_ParseVehWeaponParm(vehWeaponInfo_t *vehWeapon, char *parmName *(qboolean *)(b + vehWeaponFields[i].ofs) = (qboolean)(atof(value) != 0); break; case VF_VEHTYPE: - vehType = (vehicleType_t)GetIDForString(VehicleTable, value); - *(vehicleType_t *)(b + vehWeaponFields[i].ofs) = vehType; + vehType = (vehicleType_e)GetIDForString(VehicleTable, value); + *(vehicleType_e *)(b + vehWeaponFields[i].ofs) = vehType; break; case VF_ANIM: { int anim = GetIDForString(animTable, value); @@ -585,8 +585,8 @@ void BG_VehicleSetDefaults(vehicleInfo_t *vehicle) { //general data vehicle->type = VH_SPEEDER; //what kind of vehicle //FIXME: no saber or weapons if numHands = 2, should switch to speeder weapon, no attack anim on player - vehicle->numHands = 0; //if 2 hands, no weapons, if 1 hand, can use 1-handed weapons, if 0 hands, can use 2-handed - weapons vehicle->lookPitch = 0; //How far you can look up and down off the forward of the vehicle vehicle->lookYaw = 5; + vehicle->numHands = 0; //if 2 hands, no weapons, if 1 hand, can use 1-handed weapons, if 0 hands, can use + 2-handed weapons vehicle->lookPitch = 0; //How far you can look up and down off the forward of the vehicle vehicle->lookYaw = 5; //How far you can look left and right off the forward of the vehicle vehicle->length = 0; //how long it is - used for body length traces when turning/moving? vehicle->width = 0; //how wide it is - used for body length traces when turning/moving? @@ -631,18 +631,18 @@ void BG_VehicleSetDefaults(vehicleInfo_t *vehicle) { strcpy(vehicle->model, "models/map_objects/ships/swoop.md3"); vehicle->modelIndex = 0; //set internally, not until this vehicle is spawned into the level - vehicle->skin = NULL; //what skin to use - if make it an NPC's primary model, don't need - this? vehicle->riderAnim = BOTH_GUNSIT1; //what animation the rider uses + vehicle->skin = NULL; //what skin to use - if make it an NPC's primary model, don't + need this? vehicle->riderAnim = BOTH_GUNSIT1; //what animation the rider uses vehicle->soundOn = NULL; //sound to play when get on it vehicle->soundLoop = NULL; //sound to loop while riding it vehicle->soundOff = NULL; //sound to play when get off vehicle->exhaustFX = NULL; //exhaust effect, played from "*exhaust" bolt(s) vehicle->trailFX = NULL; //trail effect, played from "*trail" bolt(s) - vehicle->impactFX = NULL; //explosion effect, for when it blows up (should have the sound built into explosion - effect) - vehicle->explodeFX = NULL; //explosion effect, for when it blows up (should have the sound built into explosion - effect) vehicle->wakeFX = NULL; //effect itmakes when going across water + vehicle->impactFX = NULL; //explosion effect, for when it blows up (should have the sound built + into explosion effect) + vehicle->explodeFX = NULL; //explosion effect, for when it blows up (should have the sound built + into explosion effect) vehicle->wakeFX = NULL; //effect itmakes when going across water //other misc stats vehicle->gravity = VEH_DEFAULT_GRAVITY; //normal is 800 @@ -667,8 +667,9 @@ void BG_VehicleSetDefaults(vehicleInfo_t *vehicle) { vehicle->cameraOverride = qfalse; //whether or not to use all of the following 3rd person camera override values vehicle->cameraRange = 0.0f; //how far back the camera should be - normal is 80 vehicle->cameraVertOffset = 0.0f; //how high over the vehicle origin the camera should be - normal is 16 - vehicle->cameraHorzOffset = 0.0f; //how far to left/right (negative/positive) of of the vehicle origin the camera should be - - normal is 0 + vehicle->cameraHorzOffset = 0.0f; //how far to left/right (negative/positive) of of the vehicle origin the camera + should be + - normal is 0 vehicle->cameraPitchOffset = 0.0f; //a modifier on the camera's pitch (up/down angle) to the vehicle - normal is 0 vehicle->cameraFOV = 0.0f; //third person camera FOV, default is 80 vehicle->cameraAlpha = qfalse; //fade out the vehicle if it's in the way of the crosshair @@ -699,7 +700,7 @@ static qboolean BG_ParseVehicleParm(vehicleInfo_t *vehicle, const char *parmName vector3 vec; byte *b = (byte *)vehicle; int _iFieldsRead = 0; - vehicleType_t vehType; + vehicleType_e vehType; char value[MAX_STRING_CHARS]; Q_strncpyz(value, pValue, sizeof(value)); @@ -738,8 +739,8 @@ static qboolean BG_ParseVehicleParm(vehicleInfo_t *vehicle, const char *parmName *(qboolean *)(b + vehicleFields[i].ofs) = (qboolean)(atof(value) != 0); break; case VF_VEHTYPE: - vehType = (vehicleType_t)GetIDForString(VehicleTable, value); - *(vehicleType_t *)(b + vehicleFields[i].ofs) = vehType; + vehType = (vehicleType_e)GetIDForString(VehicleTable, value); + *(vehicleType_e *)(b + vehicleFields[i].ofs) = vehType; break; case VF_ANIM: { int anim = GetIDForString(animTable, value); diff --git a/game/bg_vehicles.h b/game/bg_vehicles.h index 31f9cad..f4ae1a5 100644 --- a/game/bg_vehicles.h +++ b/game/bg_vehicles.h @@ -2,7 +2,7 @@ #include "qcommon/q_shared.h" -typedef enum vehicleType_e { +enum vehicleType_e { VH_NONE = 0, // 0 just in case anyone confuses VH_NONE and VEHICLE_NONE below VH_WALKER, // something you ride inside of, it walks like you, like an AT-ST VH_FIGHTER, // something you fly inside of, like an X-Wing or TIE fighter @@ -10,14 +10,14 @@ typedef enum vehicleType_e { VH_ANIMAL, // animal you ride on top of that walks, like a tauntaun VH_FLIER, // animal you ride on top of that flies, like a giant mynoc? VH_NUM_VEHICLES -} vehicleType_t; +}; -typedef enum { +enum weaponPose_e { WPOSE_NONE = 0, WPOSE_BLASTER, WPOSE_SABERLEFT, WPOSE_SABERRIGHT, -} EWeaponPose; +}; extern stringID_table_t VehicleTable[VH_NUM_VEHICLES + 1]; @@ -38,17 +38,17 @@ typedef struct vehWeaponInfo_s { int iLoopSound; // index of loopSound float fSpeed; // speed of projectile/range of traceline float fHoming; // 0.0f = not homing, 0.5f = half vel to targ, half cur vel, 1.0f = all vel to targ - float fHomingFOV; // missile will lose lock on if DotProduct of missile direction and direction to target ever drops below this (-1 to 1, -1 = never lose - // target, 0 = lose if ship gets behind missile, 1 = pretty much will lose it's target right away) - int iLockOnTime; // 0 = no lock time needed, else # of ms needed to lock on - int iDamage; // damage done when traceline or projectile directly hits target - int iSplashDamage; // damage done to ents in splashRadius of end of traceline or projectile origin on impact - float fSplashRadius; // radius that ent must be in to take splashDamage (linear fall-off) - int iAmmoPerShot; // how much "ammo" each shot takes - int iHealth; // if non-zero, projectile can be shot, takes this much damage before being destroyed - float fWidth; // width of traceline or bounding box of projecile (non-rotating!) - float fHeight; // height of traceline or bounding box of projecile (non-rotating!) - int iLifeTime; // removes itself after this amount of time + float fHomingFOV; // missile will lose lock on if DotProduct of missile direction and direction to target ever drops below this (-1 to 1, -1 = never lose + // target, 0 = lose if ship gets behind missile, 1 = pretty much will lose it's target right away) + int iLockOnTime; // 0 = no lock time needed, else # of ms needed to lock on + int iDamage; // damage done when traceline or projectile directly hits target + int iSplashDamage; // damage done to ents in splashRadius of end of traceline or projectile origin on impact + float fSplashRadius; // radius that ent must be in to take splashDamage (linear fall-off) + int iAmmoPerShot; // how much "ammo" each shot takes + int iHealth; // if non-zero, projectile can be shot, takes this much damage before being destroyed + float fWidth; // width of traceline or bounding box of projecile (non-rotating!) + float fHeight; // height of traceline or bounding box of projecile (non-rotating!) + int iLifeTime; // removes itself after this amount of time qboolean bExplodeOnExpire; // when iLifeTime is up, explodes rather than simply removing itself } vehWeaponInfo_t; // NOTE: this MUST stay up to date with the number of variables in the vehFields table!!! @@ -288,7 +288,7 @@ typedef struct vehicleInfo_s { char *name; // unique name of the vehicle // general data - vehicleType_t type; // what kind of vehicle + vehicleType_e type; // what kind of vehicle int numHands; // if 2 hands, no weapons, if 1 hand, can use 1-handed weapons, if 0 hands, can use 2-handed weapons float lookPitch; // How far you can look up and down off the forward of the vehicle float lookYaw; // How far you can look left and right off the forward of the vehicle @@ -308,7 +308,7 @@ typedef struct vehicleInfo_s { float decelIdle; // when giving no input, how quickly it drops to speedIdle float throttleSticks; // if true, speed stays at whatever you accel/decel to, unless you turbo or brake float strafePerc; // multiplier on current speed for strafing. If 1.0f, you can strafe at the same speed as you're going forward, 0.5f is half, 0 is no - // strafing + // strafing // handling stats float bankingSpeed; // how quickly it pitches and rolls (not under player control) @@ -553,7 +553,7 @@ extern int numVehicles; #define VEH_MOUNT_THROW_LEFT -5 #define VEH_MOUNT_THROW_RIGHT -6 -typedef enum { VEH_EJECT_LEFT, VEH_EJECT_RIGHT, VEH_EJECT_FRONT, VEH_EJECT_REAR, VEH_EJECT_TOP, VEH_EJECT_BOTTOM } vehEject_t; +enum vehEject_e { VEH_EJECT_LEFT, VEH_EJECT_RIGHT, VEH_EJECT_FRONT, VEH_EJECT_REAR, VEH_EJECT_TOP, VEH_EJECT_BOTTOM }; // Vehicle flags. #define VEH_NONE (0x0000u) diff --git a/game/bg_weapons.cpp b/game/bg_weapons.cpp index 784fce0..d34ca4e 100644 --- a/game/bg_weapons.cpp +++ b/game/bg_weapons.cpp @@ -29,7 +29,8 @@ const vector3 WP_MuzzlePoint[WP_NUM_WEAPONS] = { }; const weaponData_t weaponData[WP_NUM_WEAPONS] = { - // longname ammoIndex ammoLow shotCost fireTime charge chargeMax chargeTime alt.ShotCost alt.fireTime alt.charge alt.chargeMax + // longname ammoIndex ammoLow shotCost fireTime charge chargeMax chargeTime alt.ShotCost alt.fireTime alt.charge + // alt.chargeMax // alt.chargeTime {"No Weapon", AMMO_NONE, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0}}, {"Stun Baton", AMMO_NONE, 5, 0, 400, 0, 0, 0, {0, 400, 0, 0, 0}}, @@ -65,7 +66,7 @@ const int ammoMax[AMMO_MAX] = { 10 // AMMO_DETPACK }; -weapon_t BG_FindWeapon(const char *name) { +weapon_e BG_FindWeapon(const char *name) { qboolean numeric = qtrue; const char *p = NULL; int i; @@ -81,7 +82,7 @@ weapon_t BG_FindWeapon(const char *name) { Com_Printf("BG_FindWeapon( \"%s\" ), numeric = %s\n", name, numeric ? "true" : "false"); if (numeric) { - weapon_t wp = (weapon_t)atoi(name); + weapon_e wp = (weapon_e)atoi(name); if (wp <= WP_NONE || wp > LAST_USEABLE_WEAPON) { return WP_NONE; } @@ -90,7 +91,7 @@ weapon_t BG_FindWeapon(const char *name) { for (i = 0, wd = weaponData; i < WP_NUM_WEAPONS; i++, wd++) { if (!Q_stricmp(name, wd->longName)) { - return (weapon_t)i; + return (weapon_e)i; } } diff --git a/game/bg_weapons.h b/game/bg_weapons.h index b82c364..6a33ec4 100644 --- a/game/bg_weapons.h +++ b/game/bg_weapons.h @@ -1,6 +1,6 @@ #pragma once -typedef enum weapon_e { +enum weapon_e { WP_NONE = 0, WP_STUN_BATON, WP_MELEE, @@ -21,8 +21,8 @@ typedef enum weapon_e { WP_EMPLACED_GUN, WP_TURRET, WP_NUM_WEAPONS -} weapon_t; -weapon_t BG_FindWeapon(const char *name); +}; +weapon_e BG_FindWeapon(const char *name); #define FIRST_WEAPON (WP_BRYAR_PISTOL) // this is the first weapon for next and prev weapon switching #define LAST_USEABLE_WEAPON (WP_BRYAR_OLD) // anything > this will be considered not player useable @@ -30,7 +30,7 @@ weapon_t BG_FindWeapon(const char *name); extern const vector3 WP_MuzzlePoint[WP_NUM_WEAPONS]; -typedef enum ammo_e { +enum ammo_e { AMMO_NONE = 0, AMMO_FORCE, AMMO_BLASTER, @@ -42,11 +42,11 @@ typedef enum ammo_e { AMMO_TRIPMINE, AMMO_DETPACK, AMMO_MAX -} ammo_t; +}; extern const struct weaponData_t { const char *longName; // spawning name - ammo_t ammoIndex; // index to proper ammo slot + ammo_e ammoIndex; // index to proper ammo slot int ammoLow; // count when ammo is low int shotCost; // amount of energy used per shot int fireTime; // amount of time between firings diff --git a/game/g_ICARUScb.cpp b/game/g_ICARUScb.cpp index b3e8ea8..f7ab3d5 100644 --- a/game/g_ICARUScb.cpp +++ b/game/g_ICARUScb.cpp @@ -11,7 +11,7 @@ extern stringID_table_t WPTable[]; extern stringID_table_t BSTable[]; -enum { +enum token_e { TK_EOF = -1, TK_UNDEFINED, TK_COMMENT, @@ -648,7 +648,7 @@ void Q3_Lerp2Pos(int taskID, int entID, vector3 *origin, vector3 *angles, float gentity_t *ent = &g_entities[entID]; vector3 ang; int i; - moverState_t moverState; + moverState_e moverState; if (!ent) { G_DebugPrint(WL_WARNING, "Q3_Lerp2Pos: invalid entID %d\n", entID); @@ -1328,7 +1328,7 @@ int Q3_GetString(int entID, int type, const char *name, const char **value) { //# #sep Scripts and other file paths case SET_SPAWNSCRIPT: //## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when spawned //0 - do not change these, these are equal to - //BSET_SPAWN, etc + // BSET_SPAWN, etc *value = ent->behaviorSet[BSET_SPAWN]; break; case SET_USESCRIPT: //## %s="NULL" !!"W:\game\base\scripts\!!#*.txt" # Script to run when used @@ -1584,7 +1584,7 @@ static void Q3_SetAngles(int entID, vector3 *angles) { // Lerps the origin to the destination value void Q3_Lerp2Origin(int taskID, int entID, vector3 *origin, float duration) { gentity_t *ent = &g_entities[entID]; - moverState_t moverState; + moverState_e moverState; if (!ent) { G_DebugPrint(WL_WARNING, "Q3_Lerp2Origin: invalid entID %d\n", entID); @@ -1948,7 +1948,7 @@ static void Q3_SetArmor(int entID, int data) { // FIXME: this should be a general NPC wrapper function that is called ANY time a bState is changed... static qboolean Q3_SetBState(int entID, const char *bs_name) { gentity_t *ent = &g_entities[entID]; - bState_t bSID; + bState_e bSID; if (!ent) { G_DebugPrint(WL_WARNING, "Q3_SetBState: invalid entID %d\n", entID); @@ -1960,8 +1960,8 @@ static qboolean Q3_SetBState(int entID, const char *bs_name) { return qtrue; // ok to complete } - bSID = (bState_t)(GetIDForString(BSTable, bs_name)); - if (bSID != (bState_t)-1) { + bSID = (bState_e)(GetIDForString(BSTable, bs_name)); + if (bSID != (bState_e)-1) { if (bSID == BS_SEARCH || bSID == BS_WANDER) { // FIXME: Reimplement @@ -2046,7 +2046,7 @@ static qboolean Q3_SetBState(int entID, const char *bs_name) { static qboolean Q3_SetTempBState(int entID, const char *bs_name) { gentity_t *ent = &g_entities[entID]; - bState_t bSID; + bState_e bSID; if (!ent) { G_DebugPrint(WL_WARNING, "Q3_SetTempBState: invalid entID %d\n", entID); @@ -2058,8 +2058,8 @@ static qboolean Q3_SetTempBState(int entID, const char *bs_name) { return qtrue; // ok to complete } - bSID = (bState_t)(GetIDForString(BSTable, bs_name)); - if (bSID != (bState_t)-1) { + bSID = (bState_e)(GetIDForString(BSTable, bs_name)); + if (bSID != (bState_e)-1) { ent->NPC->tempBehavior = bSID; } @@ -2082,7 +2082,7 @@ static qboolean Q3_SetTempBState(int entID, const char *bs_name) { static void Q3_SetDefaultBState(int entID, const char *bs_name) { gentity_t *ent = &g_entities[entID]; - bState_t bSID; + bState_e bSID; if (!ent) { G_DebugPrint(WL_WARNING, "Q3_SetDefaultBState: invalid entID %d\n", entID); @@ -2094,8 +2094,8 @@ static void Q3_SetDefaultBState(int entID, const char *bs_name) { return; } - bSID = (bState_t)(GetIDForString(BSTable, bs_name)); - if (bSID != (bState_t)-1) { + bSID = (bState_e)(GetIDForString(BSTable, bs_name)); + if (bSID != (bState_e)-1) { ent->NPC->defaultBehavior = bSID; } } @@ -2232,7 +2232,7 @@ void Q3_SetViewEntity(int entID, const char *name) { G_DebugPrint(WL_WARNING, "Q void ChangeWeapon(gentity_t *ent, int newWeapon); static void Q3_SetWeapon(int entID, const char *wp_name) { gentity_t *ent = &g_entities[entID]; - weapon_t wp = (weapon_t)GetIDForString(WPTable, wp_name); + weapon_e wp = (weapon_e)GetIDForString(WPTable, wp_name); ent->client->ps.stats[STAT_WEAPONS] = (1 << wp); ChangeWeapon(ent, wp); @@ -2531,8 +2531,8 @@ void Q3_SetParm(int entID, int parmNum, const char *parmValue) { } if ((val = Q3_GameSideCheckStringCounterIncrement(parmValue))) { - val += atof(ent->parms->parm[parmNum]); - Com_sprintf(ent->parms->parm[parmNum], sizeof(ent->parms->parm), "%f", val); + val += atoff(ent->parms->parm[parmNum]); + Com_sprintf(ent->parms->parm[parmNum], sizeof(ent->parms->parm), "%f", (double)val); } else { // Just copy the string // copy only 16 characters strncpy(ent->parms->parm[parmNum], parmValue, sizeof(ent->parms->parm[0])); @@ -2965,7 +2965,7 @@ static void Q3_SetNoImpactDamage(int entID, qboolean noImp) { G_DebugPrint(WL_WA static qboolean Q3_SetBehaviorSet(int entID, int toSet, const char *scriptname) { gentity_t *ent = &g_entities[entID]; - bSet_t bSet; + bSet_e bSet; if (!ent) { G_DebugPrint(WL_WARNING, "Q3_SetBehaviorSet: invalid entID %d\n", entID); diff --git a/game/g_active.cpp b/game/g_active.cpp index ceccd60..7c8609c 100644 --- a/game/g_active.cpp +++ b/game/g_active.cpp @@ -816,7 +816,7 @@ void ClientEvents(gentity_t *ent, int oldEventSequence) { ent->client->invulnerableTimer = 0; break; - // rww - Note that these must be in the same order (ITEM#-wise) as they are in holdable_t + // rww - Note that these must be in the same order (ITEM#-wise) as they are in holdable_e case EV_USE_ITEM1: // seeker droid ItemUse_Seeker(ent); break; @@ -1117,7 +1117,7 @@ void G_CheckClientIdle(gentity_t *ent, usercmd_t *ucmd) { G_SetAnim(ent, ucmd, SETANIM_BOTH, idleAnim, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD, 0); // don't idle again after this anim for a while - // ent->client->idleTime = level.time + PM_AnimLength( ent->client->clientInfo.animFileIndex, (animNumber_t)idleAnim ) + Q_irand( 0, 2000 ); + // ent->client->idleTime = level.time + PM_AnimLength( ent->client->clientInfo.animFileIndex, (animNumber_e)idleAnim ) + Q_irand( 0, 2000 ); ent->client->idleTime = level.time + ent->client->ps.legsTimer + Q_irand(0, 2000); } } @@ -1481,7 +1481,7 @@ void G_SetTauntAnim(gentity_t *ent, int taunt) { if (ent->client->ps.groundEntityNum != ENTITYNUM_NONE) { ent->client->ps.forceHandExtend = HANDEXTEND_TAUNT; ent->client->ps.forceDodgeAnim = anim; - ent->client->ps.forceHandExtendTime = level.time + BG_AnimLength(ent->localAnimIndex, (animNumber_t)anim); + ent->client->ps.forceHandExtendTime = level.time + BG_AnimLength(ent->localAnimIndex, (animNumber_e)anim); } if (taunt != TAUNT_MEDITATE && taunt != TAUNT_BOW) { // no sound for meditate or bow diff --git a/game/g_admin.cpp b/game/g_admin.cpp index dc5addc..c90949e 100644 --- a/game/g_admin.cpp +++ b/game/g_admin.cpp @@ -1875,7 +1875,7 @@ void G_SleepClient(gclient_t *cl) { } void G_WakeClient(gclient_t *cl) { - const animNumber_t anim = BOTH_GETUP1; + const animNumber_e anim = BOTH_GETUP1; cl->pers.adminData.isSlept = qfalse; cl->ps.forceHandExtendTime = level.time + BG_AnimLength(g_entities[cl->ps.clientNum].localAnimIndex, anim); cl->ps.forceDodgeAnim = anim; @@ -2569,7 +2569,7 @@ static void AM_EntList(gentity_t *ent) { } else { const float distance = ent ? Distance(&ent->s.origin, &e->s.origin) : 1337.0f; const char *classname = (e->classname && e->classname[0]) ? e->classname : "Unknown"; - Q_PrintBuffer(&pb, va("%4i: %s, type: %i, distance: %.0f, coords: %s\n", i, classname, e->s.eType, distance, vtos(&e->s.origin))); + Q_PrintBuffer(&pb, va("%4i: %s, type: %i, distance: %.0f, coords: %s\n", i, classname, e->s.eType, (double)distance, vtos(&e->s.origin))); } } Q_PrintBuffer(&pb, "\n"); @@ -2918,7 +2918,7 @@ void Merc_Off(gentity_t *ent) { } } - weapon_t wp = (weapon_t)ent->client->ps.weapon; + weapon_e wp = (weapon_e)ent->client->ps.weapon; if (newWeap != -1) { ent->client->ps.weapon = newWeap; } else { @@ -3026,7 +3026,7 @@ static void AM_Rename(gentity_t *ent) { static void AM_LockTeam(gentity_t *ent) { char arg1[16] = {}; - team_t team; + team_e team; if (trap->Argc() != 2) { AM_ConsolePrint(ent, "Syntax: \\amlockteam \n"); @@ -3085,7 +3085,7 @@ static void AM_LockTeam(gentity_t *ent) { static void AM_UnlockTeam(gentity_t *ent) { char arg1[16] = {}; - team_t team; + team_e team; if (trap->Argc() != 2) { AM_ConsolePrint(ent, "Syntax: \\amunlockteam \n"); diff --git a/game/g_bot.cpp b/game/g_bot.cpp index ddcb6e0..b03c410 100644 --- a/game/g_bot.cpp +++ b/game/g_bot.cpp @@ -301,7 +301,7 @@ void G_AddRandomBot(int team) { teamstr = ""; Q_strncpyz(netname, value, sizeof(netname)); Q_CleanString(netname, STRIP_EXTASCII); - trap->SendConsoleCommand(EXEC_INSERT, va("addbot \"%s\" %.2f %s %i\n", netname, skill, teamstr, 0)); + trap->SendConsoleCommand(EXEC_INSERT, va("addbot \"%s\" %.2f %s %i\n", netname, (double)skill, teamstr, 0)); return; } } @@ -393,7 +393,7 @@ int G_CountBotPlayers(int team) { void G_CheckMinimumPlayers(void) { int humanplayers, botplayers; - static int checkminimumplayers_time; + static int checkminimumplayers_time = 0; if (level.gametype == GT_SIEGE) return; @@ -527,7 +527,7 @@ void G_AddBot(const char *name, float skill, const char *team, int delay, char * Info_SetValueForKey(userinfo, "rate", "25000"); Info_SetValueForKey(userinfo, "snaps", "20"); Info_SetValueForKey(userinfo, "ip", "localhost"); - Info_SetValueForKey(userinfo, "skill", va("%.2f", skill)); + Info_SetValueForKey(userinfo, "skill", va("%.2f", (double)skill)); if (skill >= 1 && skill < 2) Info_SetValueForKey(userinfo, "handicap", "50"); @@ -665,7 +665,7 @@ void G_AddBot(const char *name, float skill, const char *team, int delay, char * trap->GetUserinfo(clientNum, userinfo, sizeof(userinfo)); if (bot->client->sess.sessionTeam == TEAM_SPECTATOR) - bot->client->sess.sessionTeam = (team_t)preTeam; + bot->client->sess.sessionTeam = (team_e)preTeam; if (bot->client->sess.sessionTeam == TEAM_RED) team = "Red"; diff --git a/game/g_client.cpp b/game/g_client.cpp index 48efc42..b61470c 100644 --- a/game/g_client.cpp +++ b/game/g_client.cpp @@ -6,6 +6,7 @@ #include "bg_luaevent.h" #include "JAPP/jp_csflags.h" #include "bg_lua.h" +#include "qcommon/q_shared.h" #include // g_client.c -- client functions that don't happen every frame @@ -218,7 +219,7 @@ void ThrowSaberToAttacker(gentity_t *self, gentity_t *attacker) { int altVelocity = 0; if (!ent || ent->enemy != self) { // something has gone very wrong (this should never happen) - // but in case it does.. find the saber manually + // but in case it does.. find the saber manually #ifdef _DEBUG Com_Printf("Lost the saber! Attempting to use global pointer..\n"); #endif @@ -540,7 +541,7 @@ gentity_t *SelectRandomDeathmatchSpawnPoint(void) { } // Chooses a player start, deathmatch start, etc -gentity_t *SelectRandomFurthestSpawnPoint(vector3 *avoidPoint, vector3 *origin, vector3 *angles, team_t team) { +gentity_t *SelectRandomFurthestSpawnPoint(vector3 *avoidPoint, vector3 *origin, vector3 *angles, team_e team) { gentity_t *spot = NULL; vector3 delta; float dist; @@ -723,7 +724,7 @@ gentity_t *SelectDuelSpawnPoint(int team, vector3 *avoidPoint, vector3 *origin, } // Chooses a player start, deathmatch start, etc -gentity_t *SelectSpawnPoint(vector3 *avoidPoint, vector3 *origin, vector3 *angles, team_t team) { +gentity_t *SelectSpawnPoint(vector3 *avoidPoint, vector3 *origin, vector3 *angles, team_e team) { return SelectRandomFurthestSpawnPoint(avoidPoint, origin, angles, team); /* @@ -756,7 +757,7 @@ gentity_t *SelectSpawnPoint(vector3 *avoidPoint, vector3 *origin, vector3 *angle } // Try to find a spawn point marked 'initial', otherwise use normal spawn selection. -gentity_t *SelectInitialSpawnPoint(vector3 *origin, vector3 *angles, team_t team) { +gentity_t *SelectInitialSpawnPoint(vector3 *origin, vector3 *angles, team_e team) { gentity_t *spot; spot = NULL; @@ -1025,7 +1026,7 @@ void respawn(gentity_t *ent) { } // Returns number of players on a team -int TeamCount(int ignoreClientNum, team_t team) { +int TeamCount(int ignoreClientNum, team_e team) { int i; int count = 0; @@ -1046,7 +1047,7 @@ int TeamCount(int ignoreClientNum, team_t team) { return count; } -team_t PickTeam(int ignoreClientNum) { +team_e PickTeam(int ignoreClientNum) { int counts[TEAM_NUM_TEAMS]; counts[TEAM_BLUE] = TeamCount(ignoreClientNum, TEAM_BLUE); @@ -1779,14 +1780,8 @@ extern void G_ResetSaberStyle(gentity_t *ent); qboolean ClientUserinfoChanged(int clientNum) { gentity_t *ent = g_entities + clientNum; gclient_t *client = ent->client; - team_t team = TEAM_FREE; - int health = 100, maxHealth = 100; - const char *s = NULL, *value = NULL; - char userinfo[MAX_INFO_STRING], buf[MAX_INFO_STRING], oldClientinfo[MAX_INFO_STRING], model[MAX_QPATH], forcePowers[DEFAULT_FORCEPOWERS_LEN], - oldname[MAX_NETNAME], className[MAX_QPATH], color1[16], color2[16], cp_sbRGB1[MAX_INFO_STRING], cp_sbRGB2[MAX_INFO_STRING]; - qboolean modelChanged = qfalse; - gender_t gender = GENDER_MALE; + char userinfo[MAX_INFO_STRING]; trap->GetUserinfo(clientNum, userinfo, sizeof(userinfo)); if (JPLua::Event_ClientUserinfoChanged(clientNum, userinfo)) { @@ -1806,7 +1801,7 @@ qboolean ClientUserinfoChanged(int clientNum) { } // check for malformed or illegal info strings - s = G_ValidateUserinfo(userinfo); + const char *s = G_ValidateUserinfo(userinfo); if (s && *s) { G_LogPrintf(level.log.security, "Client %s failed userinfo validation: %s\n", G_PrintClient(ent), s); trap->DropClient(clientNum, va("Failed userinfo validation: %s", s)); @@ -1838,6 +1833,7 @@ qboolean ClientUserinfoChanged(int clientNum) { client->pers.predictItemPickup = !!atoi(Info_ValueForKey(userinfo, "cg_predictItems")); // set name + char oldname[MAX_NETNAME]; Q_strncpyz(oldname, client->pers.netname, sizeof(oldname)); s = Info_ValueForKey(userinfo, "name"); ClientCleanName(s, client->pers.netname, sizeof(client->pers.netname)); @@ -1868,7 +1864,7 @@ qboolean ClientUserinfoChanged(int clientNum) { float remaining = japp_amrenameTime.value * 60.0f; remaining -= (level.time - client->pers.adminData.renamedTime) / 1000.0f; trap->SendServerCommand(clientNum, - va("print \"You are not allowed to change name for another " S_COLOR_CYAN "%.1f " S_COLOR_WHITE "seconds\n\"", remaining)); + va("print \"You are not allowed to change name for another " S_COLOR_CYAN "%.1f " S_COLOR_WHITE "seconds\n\"", (double)remaining)); } else { trap->SendServerCommand(-1, va("print \"%s" S_COLOR_WHITE " %s %s\n\"", oldname, G_GetStringEdString("MP_SVGAME", "PLRENAME"), client->pers.netname)); @@ -1878,14 +1874,17 @@ qboolean ClientUserinfoChanged(int clientNum) { } // set model + char model[MAX_QPATH]; Q_strncpyz(model, Info_ValueForKey(userinfo, "model"), sizeof(model)); + qboolean modelChanged = qfalse; if (d_perPlayerGhoul2.integer && Q_stricmp(model, client->modelname)) { Q_strncpyz(client->modelname, model, sizeof(client->modelname)); modelChanged = qtrue; } // custom skin RGB + const char *value = NULL; value = Info_ValueForKey(userinfo, "char_color_red"); client->ps.customRGBA[0] = value ? Q_clampi(0, atoi(value), 255) : 255; value = Info_ValueForKey(userinfo, "char_color_green"); @@ -1897,6 +1896,7 @@ qboolean ClientUserinfoChanged(int clientNum) { client->ps.customRGBA[0] = client->ps.customRGBA[1] = client->ps.customRGBA[2] = 255; } + char forcePowers[DEFAULT_FORCEPOWERS_LEN]; Q_strncpyz(forcePowers, Info_ValueForKey(userinfo, "forcepowers"), sizeof(forcePowers)); // update our customRGBA for team colors. @@ -1915,6 +1915,7 @@ qboolean ClientUserinfoChanged(int clientNum) { } // bots set their team a few frames later + team_e team = TEAM_FREE; if (level.gametype >= GT_TEAM && (g_entities[clientNum].r.svFlags & SVF_BOT)) { s = Info_ValueForKey(userinfo, "team"); if (!Q_stricmp(s, "red") || !Q_stricmp(s, "r")) { @@ -1930,20 +1931,21 @@ qboolean ClientUserinfoChanged(int clientNum) { } // Set the siege class + char siegeClass[MAX_QPATH]; if (level.gametype == GT_SIEGE) { - Q_strncpyz(className, client->sess.siegeClass, sizeof(className)); + Q_strncpyz(siegeClass, client->sess.siegeClass, sizeof(siegeClass)); // Now that the team is legal for sure, we'll go ahead and get an index for it. - client->siegeClass = BG_SiegeFindClassIndexByName(className); + client->siegeClass = BG_SiegeFindClassIndexByName(siegeClass); if (client->siegeClass == -1) { // ok, get the first valid class for the team you're on then, I guess. - BG_SiegeCheckClassLegality(team, className); - Q_strncpyz(client->sess.siegeClass, className, sizeof(client->sess.siegeClass)); - client->siegeClass = BG_SiegeFindClassIndexByName(className); + BG_SiegeCheckClassLegality(team, siegeClass); + Q_strncpyz(client->sess.siegeClass, siegeClass, sizeof(client->sess.siegeClass)); + client->siegeClass = BG_SiegeFindClassIndexByName(siegeClass); } else { // otherwise, make sure the class we are using is legal. G_ValidateSiegeClassForTeam(ent, team); - Q_strncpyz(className, client->sess.siegeClass, sizeof(className)); + Q_strncpyz(siegeClass, client->sess.siegeClass, sizeof(siegeClass)); } if (client->siegeClass != -1) { @@ -1982,7 +1984,7 @@ qboolean ClientUserinfoChanged(int clientNum) { } } } else { - Q_strncpyz(className, "none", sizeof(className)); + Q_strncpyz(siegeClass, "none", sizeof(siegeClass)); } // only set the saber name on the first connect @@ -1994,6 +1996,8 @@ qboolean ClientUserinfoChanged(int clientNum) { } // set max health + int health = 100; + int maxHealth = 100; if (level.gametype == GT_SIEGE && client->siegeClass != -1) { siegeClass_t *scl = &bgSiegeClasses[client->siegeClass]; @@ -2023,13 +2027,18 @@ qboolean ClientUserinfoChanged(int clientNum) { } } - // colors + // saber colors + char color1[16]; + char color2[16]; Q_strncpyz(color1, Info_ValueForKey(userinfo, "color1"), sizeof(color1)); Q_strncpyz(color2, Info_ValueForKey(userinfo, "color2"), sizeof(color2)); + char cp_sbRGB1[MAX_CVAR_VALUE_STRING]; + char cp_sbRGB2[MAX_CVAR_VALUE_STRING]; Q_strncpyz(cp_sbRGB1, Info_ValueForKey(userinfo, "cp_sbRGB1"), sizeof(cp_sbRGB1)); Q_strncpyz(cp_sbRGB2, Info_ValueForKey(userinfo, "cp_sbRGB2"), sizeof(cp_sbRGB2)); // Raz: Gender hints + gender_e gender = GENDER_MALE; s = Info_ValueForKey(userinfo, "sex"); if (!Q_stricmp(s, "male")) { gender = GENDER_MALE; @@ -2048,7 +2057,7 @@ qboolean ClientUserinfoChanged(int clientNum) { // send over a subset of the userinfo keys so other clients can // print scoreboards, display models, and play custom sounds - buf[0] = '\0'; + char buf[MAX_INFO_STRING] = {'\0'}; Q_strcat(buf, sizeof(buf), va("n\\%s\\", client->pers.netname)); Q_strcat(buf, sizeof(buf), va("t\\%i\\", client->sess.sessionTeam)); Q_strcat(buf, sizeof(buf), va("model\\%s\\", model)); @@ -2077,11 +2086,10 @@ qboolean ClientUserinfoChanged(int clientNum) { Q_strcat(buf, sizeof(buf), va("dt\\%i\\", client->sess.duelTeam)); } if (level.gametype == GT_SIEGE) { - Q_strcat(buf, sizeof(buf), va("siegeclass\\%s\\", className)); + Q_strcat(buf, sizeof(buf), va("siegeclass\\%s\\", siegeClass)); Q_strcat(buf, sizeof(buf), va("sdt\\%i\\", client->sess.siegeDesiredTeam)); } - trap->GetConfigstring(CS_PLAYERS + clientNum, oldClientinfo, sizeof(oldClientinfo)); trap->SetConfigstring(CS_PLAYERS + clientNum, buf); // only going to be true for allowable server-side custom skeleton cases @@ -2101,7 +2109,9 @@ qboolean ClientUserinfoChanged(int clientNum) { } if (g_logClientInfo.integer) { - if (strcmp(oldClientinfo, buf)) { + char oldClientInfo[MAX_INFO_STRING]; + trap->GetConfigstring(CS_PLAYERS + clientNum, oldClientInfo, sizeof(oldClientInfo)); + if (strcmp(oldClientInfo, buf)) { G_LogPrintf(level.log.console, "ClientUserinfoChanged: %i %s\n", clientNum, buf); } else { G_LogPrintf(level.log.console, "ClientUserinfoChanged: %i \n", clientNum); @@ -2378,7 +2388,7 @@ void ClientBegin(int clientNum, qboolean allowTeamReset) { preSess = ent->client->sess.sessionTeam; G_ReadClientSessionData(ent->client); - ent->client->sess.sessionTeam = (team_t)preSess; + ent->client->sess.sessionTeam = (team_e)preSess; G_WriteClientSessionData(ent->client); if (!ClientUserinfoChanged(clientNum)) return; @@ -2569,8 +2579,8 @@ void G_UpdateClientAnims(gentity_t *self, float animSpeedScale) { static int aFlags; static float animSpeed, lAnimSpeedScale; qboolean setTorso = qfalse; - animNumber_t torsoAnim = (animNumber_t)self->client->ps.torsoAnim; - animNumber_t legsAnim = (animNumber_t)self->client->ps.legsAnim; + animNumber_e torsoAnim = (animNumber_e)self->client->ps.torsoAnim; + animNumber_e legsAnim = (animNumber_e)self->client->ps.legsAnim; if (self->client->ps.saberLockFrame) { trap->G2API_SetBoneAnim(self->ghoul2, 0, "model_root", self->client->ps.saberLockFrame, self->client->ps.saberLockFrame + 1, @@ -3156,7 +3166,7 @@ void ClientSpawn(gentity_t *ent) { // give ammo for all available weapons for (i = WP_BRYAR_PISTOL; i <= LAST_USEABLE_WEAPON; i++) { if (spawnWeaps & (1 << i)) { - ammo_t ammo = weaponData[i].ammoIndex; + ammo_e ammo = weaponData[i].ammoIndex; const gitem_t *it = BG_FindItemForAmmo(ammo); if (it) client->ps.ammo[ammo] += it->quantity; @@ -3182,7 +3192,7 @@ void ClientSpawn(gentity_t *ent) { newWeap = WP_NONE; } - weapon_t wp = (weapon_t)ent->client->ps.weapon; + weapon_e wp = (weapon_e)ent->client->ps.weapon; if (newWeap != -1) ent->client->ps.weapon = newWeap; else @@ -3410,16 +3420,16 @@ void ClientSpawn(gentity_t *ent) { if (level.gametype == GT_SIEGE) { // Imperial (team1) team is allied with "enemy" NPCs in this mode if (client->sess.sessionTeam == SIEGETEAM_TEAM1) { ent->s.teamowner = NPCTEAM_ENEMY; - client->playerTeam = (npcteam_t)ent->s.teamowner; + client->playerTeam = (npcteam_e)ent->s.teamowner; client->enemyTeam = NPCTEAM_PLAYER; } else { ent->s.teamowner = NPCTEAM_PLAYER; - client->playerTeam = (npcteam_t)ent->s.teamowner; + client->playerTeam = (npcteam_e)ent->s.teamowner; client->enemyTeam = NPCTEAM_ENEMY; } } else { ent->s.teamowner = NPCTEAM_PLAYER; - client->playerTeam = (npcteam_t)ent->s.teamowner; + client->playerTeam = (npcteam_e)ent->s.teamowner; client->enemyTeam = NPCTEAM_ENEMY; } diff --git a/game/g_cmds.cpp b/game/g_cmds.cpp index 8e84a17..404c5cc 100644 --- a/game/g_cmds.cpp +++ b/game/g_cmds.cpp @@ -392,7 +392,7 @@ qboolean g_preventTeamBegin = qfalse; qboolean SetTeam(gentity_t *ent, const char *s, qboolean forced) { int team, oldTeam, clientNum, specClient; gclient_t *client; - spectatorState_t specState; + spectatorState_e specState; // this prevents rare creation of invalid players if (!ent->inuse) { @@ -525,7 +525,7 @@ qboolean SetTeam(gentity_t *ent, const char *s, qboolean forced) { G_ClearVote(ent); } - client->sess.sessionTeam = (team_t)team; + client->sess.sessionTeam = (team_e)team; client->sess.spectatorState = specState; client->sess.spectatorClient = specClient; @@ -1247,7 +1247,7 @@ static void Cmd_SayTeamMod_f(gentity_t *ent) { int i = ent->client->pers.sayTeamMethod; i++; i %= STM_NUM_METHODS; - ent->client->pers.sayTeamMethod = (sayTeamMethod_t)i; + ent->client->pers.sayTeamMethod = (sayTeamMethod_e)i; } else { @@ -1257,7 +1257,7 @@ static void Cmd_SayTeamMod_f(gentity_t *ent) { trap->Argv(1, arg, sizeof(arg)); for (i = 0; i < STM_NUM_METHODS; i++) { if (!Q_stricmp(arg, sayTeamMethods[i])) { - ent->client->pers.sayTeamMethod = (sayTeamMethod_t)i; + ent->client->pers.sayTeamMethod = (sayTeamMethod_e)i; break; } } @@ -1623,7 +1623,7 @@ static qboolean G_VoteTimelimit(gentity_t *ent, int numArgs, const char *arg1, c if (Q_isintegral(tl)) Com_sprintf(level.voteString, sizeof(level.voteString), "%s %i", arg1, (int)tl); else - Com_sprintf(level.voteString, sizeof(level.voteString), "%s %.3f", arg1, tl); + Com_sprintf(level.voteString, sizeof(level.voteString), "%s %.3f", arg1, (double)tl); Q_strncpyz(level.voteDisplayString, level.voteString, sizeof(level.voteDisplayString)); Q_strncpyz(level.voteStringClean, level.voteString, sizeof(level.voteStringClean)); return qtrue; @@ -1649,7 +1649,12 @@ typedef struct voteString_s { } voteString_t; static voteString_t validVoteStrings[] = { - // vote string aliases # args valid gametypes exec delay short help long + // vote string aliases # args valid gametypes + // exec + // delay + // short + // help + // long // help {"allready", "ready", G_VoteAllready, 0, GTB_ALL, qfalse, NULL, ""}, {"capturelimit", "caps", G_VoteCapturelimit, 1, GTB_CTF | GTB_CTY, qtrue, "", ""}, @@ -1912,7 +1917,7 @@ void G_LeaveVehicle(gentity_t *ent, qboolean ConCheck) { if (veh->inuse && veh->client && veh->m_pVehicle) { if (ConCheck) { // check connection - clientConnected_t pCon = ent->client->pers.connected; + clientConnected_e pCon = ent->client->pers.connected; ent->client->pers.connected = CON_DISCONNECTED; veh->m_pVehicle->m_pVehicleInfo->Eject(veh->m_pVehicle, (bgEntity_t *)ent, qtrue); ent->client->pers.connected = pCon; @@ -2305,7 +2310,7 @@ void Cmd_EngageDuel_f(gentity_t *ent, bool fullforce) { weaponData[challenged->client->pers.duelWeapon].longName)); if (japp_duelBow.integer) { - int bowTime = BG_AnimLength(ent->localAnimIndex, (animNumber_t)BOTH_BOW); + int bowTime = BG_AnimLength(ent->localAnimIndex, (animNumber_e)BOTH_BOW); ent->client->ps.forceHandExtend = challenged->client->ps.forceHandExtend = HANDEXTEND_TAUNT; ent->client->ps.forceDodgeAnim = challenged->client->ps.forceDodgeAnim = BOTH_BOW; ent->client->ps.forceHandExtendTime = challenged->client->ps.forceHandExtendTime = level.time + bowTime; @@ -2391,7 +2396,7 @@ void Cmd_EngageDuel_f(gentity_t *ent, bool fullforce) { const weaponData_t *wd = &weaponData[challenged->client->pers.duelWeapon]; if (wd->shotCost != 0) { // this weapon requires ammo, give it - ammo_t ammo = G_AmmoForWeapon((weapon_t)challenged->client->pers.duelWeapon); + ammo_e ammo = G_AmmoForWeapon((weapon_e)challenged->client->pers.duelWeapon); ent->client->ps.ammo[ammo] = challenged->client->ps.ammo[ammo] = ammoMax[wd->ammoIndex]; } @@ -2665,7 +2670,7 @@ static void Cmd_Drop_f(gentity_t *ent) { trap->Argv(1, arg, sizeof(arg)); if (!Q_stricmp(arg, "flag")) { - powerup_t powerup = (ent->client->ps.persistant[PERS_TEAM] == TEAM_RED) ? PW_BLUEFLAG : PW_REDFLAG; + powerup_e powerup = (ent->client->ps.persistant[PERS_TEAM] == TEAM_RED) ? PW_BLUEFLAG : PW_REDFLAG; if (!japp_allowFlagDrop.integer) { trap->SendServerCommand(ent - g_entities, "print \"" S_COLOR_YELLOW "Not allowed to drop the flag\n\""); @@ -2694,7 +2699,7 @@ static void Cmd_Drop_f(gentity_t *ent) { ent->client->ps.powerups[powerup] = 0; } } else if (!Q_stricmp(arg, "weapon")) { - weapon_t wp = (weapon_t)ent->client->ps.weapon, newWeap = WP_NONE; + weapon_e wp = (weapon_e)ent->client->ps.weapon, newWeap = WP_NONE; const gitem_t *item = NULL; gentity_t *drop = NULL; vector3 angs = {0.0f, 0.0f, 0.0f}; @@ -2735,7 +2740,7 @@ static void Cmd_Drop_f(gentity_t *ent) { for (i = 0; i < WP_NUM_WEAPONS; i++) { if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << i)) && i != WP_NONE) { // this one's good - newWeap = (weapon_t)i; + newWeap = (weapon_e)i; break; } } @@ -2756,7 +2761,7 @@ static void Cmd_Drop_f(gentity_t *ent) { } else if (!Q_stricmp(arg, "powerup")) { gentity_t *drop = NULL; vector3 angs = {0.0f, 0.0f, 0.0f}; - powerup_t powerup = PW_NONE; + powerup_e powerup = PW_NONE; const gitem_t *item = NULL; if (ent->client->ps.powerups[PW_FORCE_ENLIGHTENED_DARK] >= level.time && ent->client->pers.adminData.logineffect != PW_FORCE_ENLIGHTENED_DARK) { @@ -2872,11 +2877,11 @@ static void Cmd_AMInfo_f(gentity_t *ent) { Q_PrintBuffer(&pb, va(" [%s" S_COLOR_WHITE "] Reduce blocks (", (tweaks & SABERTWEAK_REDUCEBLOCKS) ? S_COLOR_GREEN "+" : S_COLOR_RED "x")); Q_PrintBuffer(&pb, va("%s%.02f " S_COLOR_WHITE "- %s%.02f" S_COLOR_WHITE ") * %s%.02f" S_COLOR_WHITE "\n", (japp_saberBlockChanceMin.value != atoff(G_Cvar_DefaultString(&japp_saberBlockChanceMin))) ? S_COLOR_RED : S_COLOR_GREEN, - japp_saberBlockChanceMin.value, + (double)japp_saberBlockChanceMin.value, (japp_saberBlockChanceMax.value != atoff(G_Cvar_DefaultString(&japp_saberBlockChanceMax))) ? S_COLOR_RED : S_COLOR_GREEN, - japp_saberBlockChanceMax.value, + (double)japp_saberBlockChanceMax.value, (japp_saberBlockChanceScale.value != atoff(G_Cvar_DefaultString(&japp_saberBlockChanceScale))) ? S_COLOR_RED : S_COLOR_GREEN, - japp_saberBlockChanceScale.value)); + (double)japp_saberBlockChanceScale.value)); #ifdef _DEBUG if (tweaks & SABERTWEAK_REDUCEBLOCKS) { int ourLevel, theirLevel; @@ -2888,7 +2893,7 @@ static void Cmd_AMInfo_f(gentity_t *ent) { const float chanceMax = japp_saberBlockChanceMax.value; const float chanceScalar = japp_saberBlockChanceScale.value; const float chance = Q_clamp(chanceMin, (1.0f - (diff / parity)) * chanceScalar, chanceMax); - Q_PrintBuffer(&pb, va(" %i blocking %i: %.03f\n", ourLevel, theirLevel, chance)); + Q_PrintBuffer(&pb, va(" %i blocking %i: %.03f\n", ourLevel, theirLevel, (double)chance)); } } } @@ -2897,7 +2902,7 @@ static void Cmd_AMInfo_f(gentity_t *ent) { Q_PrintBuffer(&pb, va(" %s%.03f " S_COLOR_WHITE "stance parity\n", (japp_saberBlockStanceParity.value != atoff(G_Cvar_DefaultString(&japp_saberBlockStanceParity))) ? S_COLOR_RED : S_COLOR_GREEN, - japp_saberBlockStanceParity.value)); + (double)japp_saberBlockStanceParity.value)); Q_PrintBuffer(&pb, va(" [%s" S_COLOR_WHITE "] Staff deflect fix\n", (tweaks & SABERTWEAK_TWOBLADEDEFLECTFIX) ? S_COLOR_GREEN "+" : S_COLOR_RED "x")); Q_PrintBuffer(&pb, va(" [%s" S_COLOR_WHITE "] Nerf damage\n", d_saberSPStyleDamage.integer ? S_COLOR_YELLOW "-" @@ -2913,7 +2918,7 @@ static void Cmd_AMInfo_f(gentity_t *ent) { // damage scale Q_PrintBuffer(&pb, va(" %s%.03f " S_COLOR_WHITE "damage scale\n", (g_saberDamageScale.value != atoff(G_Cvar_DefaultString(&g_saberDamageScale))) ? S_COLOR_RED : S_COLOR_GREEN, - g_saberDamageScale.value)); + (double)g_saberDamageScale.value)); // idle damage Q_PrintBuffer(&pb, va(" " S_COLOR_WHITE "Idle damage %s %s" S_COLOR_WHITE "\n", @@ -3165,7 +3170,7 @@ static const size_t numEmotes = ARRAY_LEN(emotes); static int emotecmp(const void *a, const void *b) { return strcmp((const char *)a, ((const emote_t *)b)->name); } qboolean SetEmote(gentity_t *ent, const emote_t *emote) { - forceHandAnims_t handExtend = HANDEXTEND_TAUNT; + forceHandAnims_e handExtend = HANDEXTEND_TAUNT; int emoteTime; if (!(japp_allowEmotes.bits & (1 << level.gametype))) { diff --git a/game/g_combat.cpp b/game/g_combat.cpp index 41ace80..67de6a1 100644 --- a/game/g_combat.cpp +++ b/game/g_combat.cpp @@ -34,7 +34,7 @@ qboolean G_HeavyMelee(gentity_t *attacker) { return qfalse; } -hitLocation_t G_GetHitLocation(gentity_t *target, vector3 *ppoint) { +hitLocation_e G_GetHitLocation(gentity_t *target, vector3 *ppoint) { vector3 point, point_dir, fwd, rt, up, tangles, tcenter; float udot, fdot, rdot; int vertical, forward, lateral, hitLoc; @@ -246,7 +246,7 @@ void TossClientWeapon(gentity_t *self, vector3 *direction, float speed) { } // find the item type for this weapon - item = BG_FindItemForWeapon((weapon_t)weapon); + item = BG_FindItemForWeapon((weapon_e)weapon); ammoSub = (self->client->ps.ammo[weaponData[weapon].ammoIndex] - bg_itemlist[BG_GetItemIndexByTag(weapon, IT_WEAPON)].quantity); @@ -338,7 +338,7 @@ void TossClientItems(gentity_t *self) { gentity_t *te; // find the item type for this weapon - item = BG_FindItemForWeapon((weapon_t)weapon); + item = BG_FindItemForWeapon((weapon_e)weapon); // tell all clients to remove the weapon model on this guy until he respawns te = G_TempEntity(&vec3_origin, EV_DESTROY_WEAPON_MODEL); @@ -354,7 +354,7 @@ void TossClientItems(gentity_t *self) { angle = 45; for (i = 1; i < PW_NUM_POWERUPS; i++) { if (self->client->ps.powerups[i] > level.time) { - item = BG_FindItemForPowerup((powerup_t)i); + item = BG_FindItemForPowerup((powerup_e)i); if (!item) { continue; } diff --git a/game/g_items.cpp b/game/g_items.cpp index efbddfa..df0e45c 100644 --- a/game/g_items.cpp +++ b/game/g_items.cpp @@ -1974,7 +1974,7 @@ qboolean CheckItemCanBePickedUpByNPC(gentity_t *item, gentity_t *pickerupper) { && !(pickerupper->NPC->scriptFlags & SCF_FORCED_MARCH) // not being forced to march /*&& item->item->giTag != INV_SECURITY_KEY*/) { // non-player, in combat, picking up a dropped item that does NOT belong to the player and it *not* a // security key - if (level.time - item->s.time < 3000) // was 5000 + if (level.time - item->s.time < 3000) // was 5000 { return qfalse; } @@ -2416,9 +2416,9 @@ void FinishSpawningItem(gentity_t *ent) { } } else { if (ent->item->giType == IT_AMMO) { - ammo_t ammo_type = (ammo_t)ent->item->giTag; + ammo_e ammo_type = (ammo_e)ent->item->giTag; for (int i = WP_BRYAR_PISTOL; i < WP_NUM_WEAPONS; i++) { - if (G_AmmoForWeapon((weapon_t)i) == ammo_type) { + if (G_AmmoForWeapon((weapon_e)i) == ammo_type) { if (g_weaponDisable.bits & i) { continue; // disabled } else { diff --git a/game/g_local.h b/game/g_local.h index 043c74c..a79a157 100644 --- a/game/g_local.h +++ b/game/g_local.h @@ -4,10 +4,6 @@ #pragma once -#ifdef _DEBUG -#define DEBUG_SABER_BOX -#endif - #define FOFS(x) offsetof(gentity_t, x) #include "qcommon/q_shared.h" @@ -146,9 +142,9 @@ typedef struct gclient_s gclient_t; #define MOVER_PLAYER_USE (0x0040) #define MOVER_INACTIVE (0x0080) -typedef enum moverState_e { MOVER_POS1, MOVER_POS2, MOVER_1TO2, MOVER_2TO1 } moverState_t; +enum moverState_e { MOVER_POS1, MOVER_POS2, MOVER_1TO2, MOVER_2TO1 }; -typedef enum hitLocation_e { +enum hitLocation_e { HL_NONE = 0, HL_FOOT_RT, HL_FOOT_LT, @@ -173,71 +169,71 @@ typedef enum hitLocation_e { HL_GENERIC5, HL_GENERIC6, HL_MAX -} hitLocation_t; +}; -typedef enum damageRedirect_e { +enum damageRedirect_e { DR_NONE = 0, DR_HEAD, DR_RLEG, DR_LLEG, -} damageRedirect_t; +}; -typedef enum clientConnected_e { CON_DISCONNECTED, CON_CONNECTING, CON_CONNECTED } clientConnected_t; +enum clientConnected_e { CON_DISCONNECTED, CON_CONNECTING, CON_CONNECTED }; -typedef enum spectatorState_e { SPECTATOR_NOT, SPECTATOR_FREE, SPECTATOR_FOLLOW, SPECTATOR_SCOREBOARD } spectatorState_t; +enum spectatorState_e { SPECTATOR_NOT, SPECTATOR_FREE, SPECTATOR_FOLLOW, SPECTATOR_SCOREBOARD }; -typedef enum playerTeamStateState_e { +enum playerTeamStateState_e { TEAM_BEGIN, // Beginning a team game, spawn at base TEAM_ACTIVE // Now actively playing -} playerTeamStateState_t; +}; -typedef enum sayTeamMethod_e { STM_TEAM = 0, STM_ADMIN, STM_CENTERPRINT, STM_PLUGIN, STM_NUM_METHODS } sayTeamMethod_t; +enum sayTeamMethod_e { STM_TEAM = 0, STM_ADMIN, STM_CENTERPRINT, STM_PLUGIN, STM_NUM_METHODS }; -typedef enum chatType_e { +enum chatType_e { SAY_ALL = 0, SAY_TEAM, SAY_TELL, SAY_ADMIN, -} chatType_t; +}; -typedef enum alertEventType_e { +enum alertEventType_e { AET_SIGHT, AET_SOUND, -} alertEventType_t; +}; -typedef enum alertEventLevel_e { +enum alertEventLevel_e { AEL_NONE = 0, AEL_MINOR, // Enemy responds to the sound, but only by looking AEL_SUSPICIOUS, // Enemy looks at the sound, and will also investigate it AEL_DISCOVERED, // Enemy knows the player is around, and will actively hunt AEL_DANGER, // Enemy should try to find cover AEL_DANGER_GREAT, // Enemy should run like hell! -} alertEventLevel_t; +}; -typedef enum teleportBits_e { +enum teleportBits_e { JAPP_TPBIT_SILENT = 0, JAPP_TPBIT_NOSLICK, JAPP_TPBIT_KEEPVELOCITY, JAPP_TPBIT_KEEPANGLES, JAPP_TPBIT_NOTELEFRAG, -} teleportBits_t; +}; -typedef enum userinfoValidationBits_e { +enum userinfoValidationBits_e { // validation & (1<<(numUserinfoFields+USERINFO_VALIDATION_BLAH)) USERINFO_VALIDATION_SIZE = 0, USERINFO_VALIDATION_SLASH, USERINFO_VALIDATION_EXTASCII, USERINFO_VALIDATION_CONTROLCHARS, USERINFO_VALIDATION_MAX -} userinfoValidationBits_t; +}; -typedef enum matchPause_e { +enum matchPause_e { PAUSE_NONE = 0, PAUSE_PAUSED, PAUSE_UNPAUSING, -} matchPause_t; +}; -typedef enum brushMoveState_e { BMS_START = 0, BMS_MID, BMS_END } brushMoveState_t; +enum brushMoveState_e { BMS_START = 0, BMS_MID, BMS_END }; struct gentity_s { entityState_t s; // communicated by server to clients @@ -302,7 +298,7 @@ struct gentity_s { const char *NPC_type; char *NPC_targetname; char *NPC_target; - moverState_t moverState; + moverState_e moverState; int soundPos1, sound1to2, sound2to1, soundPos2, soundLoop; gentity_t *parent; gentity_t *nextTrain, *prevTrain; @@ -405,7 +401,7 @@ struct gentity_s { }; typedef struct playerTeamState_s { - playerTeamStateState_t state; + playerTeamStateState_e state; int location; int captures; int basedefense; @@ -420,9 +416,9 @@ typedef struct playerTeamState_s { } playerTeamState_t; typedef struct clientSession_s { - team_t sessionTeam; + team_e sessionTeam; int spectatorTime; // for determining next-in-line to play - spectatorState_t spectatorState; + spectatorState_e spectatorState; int spectatorClient; // for chasecam and follow mode int wins, losses; // tournament stats unsigned int selectedFP; // check against this, if doesn't match value in playerstate then update userinfo @@ -437,7 +433,7 @@ typedef struct clientSession_s { } clientSession_t; typedef struct clientPersistant_s { - clientConnected_t connected; + clientConnected_e connected; usercmd_t cmd; // we would lose angles if not persistant qboolean localClient; // true if "ip" info key is "localhost" qboolean initialSpawn; // the first spawn should be at a cool location @@ -460,7 +456,7 @@ typedef struct clientPersistant_s { vector3 duelStartPos; // respawn client to this position when duel ends uint32_t ignore; int speed; - sayTeamMethod_t sayTeamMethod; + sayTeamMethod_e sayTeamMethod; } clientPersistant_t; typedef struct clientTrail_s { @@ -490,7 +486,7 @@ typedef struct renderInfo_s { vector3 torsoAngles; vector3 eyePoint, eyeAngles; int lookTarget; - lookMode_t lookMode; + lookMode_e lookMode; int lookTargetClearTime; // Time to clear the lookTarget int lastVoiceVolume; // Last frame's voice volume vector3 lastHeadAngles; // Last headAngles, NOT actual facing of head model @@ -505,7 +501,7 @@ typedef struct renderInfo_s { typedef struct emote_s { const char *name; - animNumber_t animLoop, animLeave; + animNumber_e animLoop, animLeave; uint32_t flags; } emote_t; @@ -580,9 +576,9 @@ struct gclient_s { float hiddenDist; // How close ents have to be to pick you up as an enemy vector3 hiddenDir; // Normalized direction in which NPCs can't see you (you are hidden) renderInfo_t renderInfo; - npcteam_t playerTeam, enemyTeam; + npcteam_e playerTeam, enemyTeam; gentity_t *leader; - class_t NPC_class; + class_e NPC_class; vector3 pushVec; int pushVecTime; int siegeClass; @@ -617,7 +613,7 @@ struct gclient_s { qboolean scoresWaiting; struct { qboolean freeze; - animNumber_t nextAnim; + animNumber_e nextAnim; } emote; struct { int drain, lightning; @@ -640,8 +636,8 @@ typedef struct combatPoint_s { typedef struct alertEvent_s { vector3 position; // Where the event is located float radius; // Consideration radius - alertEventLevel_t level; // Priority level of the event - alertEventType_t type; // Event type (sound,sight) + alertEventLevel_e level; // Priority level of the event + alertEventType_e type; // Event type (sound,sight) gentity_t *owner; // Who made the sound float light; // ambient light level at point float addLight; // additional light- makes it more noticable, even in darkness @@ -775,8 +771,8 @@ typedef struct bot_settings_s { void Add_Ammo(gentity_t *ent, int weapon, int count); void AddRemap(const char *oldShader, const char *newShader, float timeOffset); void AddScore(gentity_t *ent, vector3 *origin, int score); -void AddSightEvent(gentity_t *owner, vector3 *position, float radius, alertEventLevel_t alertLevel, float addLight); -void AddSoundEvent(gentity_t *owner, vector3 *position, float radius, alertEventLevel_t alertLevel, qboolean needLOS); +void AddSightEvent(gentity_t *owner, vector3 *position, float radius, alertEventLevel_e alertLevel, float addLight); +void AddSoundEvent(gentity_t *owner, vector3 *position, float radius, alertEventLevel_e alertLevel, qboolean needLOS); void B_InitAlloc(void); void BeginIntermission(void); void Blocked_Mover(gentity_t *ent, gentity_t *other); @@ -840,7 +836,7 @@ void G_AddEvent(gentity_t *ent, int event, int eventParm); void G_AddPredictableEvent(gentity_t *ent, int event, int eventParm); char *G_AddSpawnVarToken(const char *string); void *G_Alloc(int size); -ammo_t G_AmmoForWeapon(weapon_t weapon); +ammo_e G_AmmoForWeapon(weapon_e weapon); void G_Announce(const char *msg); void G_Announce(const char *msg, int except); void G_AvoidBox(gentity_t *ent); @@ -978,7 +974,7 @@ void G_SpawnItem(gentity_t *ent, const gitem_t *item); gentity_t *G_SpawnReservedEntity(void); qboolean G_SpawnString(const char *key, const char *defaultString, char **out); qboolean G_SpawnVector(const char *key, const char *defaultString, vector3 *out); -void G_TeamCommand(team_t team, const char *cmd); +void G_TeamCommand(team_e team, const char *cmd); gentity_t *G_TempEntity(vector3 *origin, int event); void G_TestLine(vector3 *start, vector3 *end, int color, int time); void G_Throw(gentity_t *targ, vector3 *newDir, float push); @@ -1014,14 +1010,14 @@ void Jetpack_On(gentity_t *ent); gentity_t *LaunchItem_Throw(const gitem_t *item, vector3 *origin, vector3 *velocity); qboolean LogAccuracyHit(gentity_t *target, gentity_t *attacker); void MaintainBodyQueue(gentity_t *ent); -void MatchTeam(gentity_t *teamLeader, moverState_t moverState, int time); +void MatchTeam(gentity_t *teamLeader, moverState_e moverState, int time); void MoveClientToIntermission(gentity_t *client); float NPC_GetHFOVPercentage(vector3 *spot, vector3 *from, vector3 *facing, float hFOV); float NPC_GetVFOVPercentage(vector3 *spot, vector3 *from, vector3 *facing, float vFOV); gentity_t *NPC_SpawnType(gentity_t *ent, const char *npc_type, const char *targetname, qboolean isVehicle, vector3 *origin); qboolean OnSameTeam(gentity_t *ent1, gentity_t *ent2); int OrgVisible(vector3 *org1, vector3 *org2, int ignore); -team_t PickTeam(int ignoreClientNum); +team_e PickTeam(int ignoreClientNum); void player_die(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod); void PrecacheItem(const gitem_t *it); void RegisterItem(const gitem_t *item); @@ -1032,7 +1028,7 @@ void ResetItem(gentity_t *ent); qboolean CheckPushItem(gentity_t *ent); qboolean saberKnockOutOfHand(gentity_t *saberent, gentity_t *saberOwner, const vector3 *velocity); void SaveRegisteredItems(void); -gentity_t *SelectSpawnPoint(vector3 *avoidPoint, vector3 *origin, vector3 *angles, team_t team); +gentity_t *SelectSpawnPoint(vector3 *avoidPoint, vector3 *origin, vector3 *angles, team_e team); void SendScoreboardMessageToAllClients(void); void SetClientViewAngle(gentity_t *ent, vector3 *angle); qboolean SetTeam(gentity_t *ent, const char *s, qboolean forced); @@ -1055,7 +1051,7 @@ int TAG_GetOrigin2(const char *owner, const char *name, vector3 *origin); int TAG_GetAngles(const char *owner, const char *name, vector3 *angles); int TAG_GetRadius(const char *owner, const char *name); uint32_t TAG_GetFlags(const char *owner, const char *name); -int TeamCount(int ignoreClientNum, team_t team); +int TeamCount(int ignoreClientNum, team_e team); void Team_CheckDroppedItem(gentity_t *dropped); void TeleportPlayer(gentity_t *player, vector3 *origin, vector3 *angles); void TIMER_Clear(void); diff --git a/game/g_log.cpp b/game/g_log.cpp index 4f6cf5c..8de9cd8 100644 --- a/game/g_log.cpp +++ b/game/g_log.cpp @@ -266,7 +266,7 @@ void G_LogWeaponOutput(void) { } else { pershot = 0; } - G_LogPrintf(level.log.console, "%15s: Damage: %6d, Kills: %5d, Dmg per Shot: %f\n", weaponNameFromIndex[j], totaldamage[j], totalkills[j], pershot); + G_LogPrintf(level.log.console, "%15s: Damage: %6d, Kills: %5d, Dmg per Shot: %f\n", weaponNameFromIndex[j], totaldamage[j], totalkills[j], (double)pershot); } G_LogPrintf(level.log.console, "\n****Combat Data By Damage Type:\n"); @@ -1172,7 +1172,7 @@ qboolean CalculateTeamRedShirt(gentity_t *ent) { return qfalse; } -typedef enum { +enum awardType_e { AWARD_EFFICIENCY, // Accuracy AWARD_SHARPSHOOTER, // Most compression rifle frags AWARD_UNTOUCHABLE, // Perfect (no deaths) @@ -1183,9 +1183,9 @@ typedef enum { AWARD_TEAM, // MVP/Defender/Warrior/Carrier/Interceptor/Bravery AWARD_SECTION31, // All-around god AWARD_MAX -} awardType_t; +}; -typedef enum { +enum teamAward_e { TEAM_NONE = 0, // ha ha! you suck! TEAM_MVP, // most overall points TEAM_DEFENDER, // killed the most baddies near your flag @@ -1194,7 +1194,7 @@ typedef enum { TEAM_INTERCEPTOR, // returned your own flag the most TEAM_BRAVERY, // Red Shirt Award (tm). you died more than anybody. TEAM_MAX -} teamAward_e; +}; int CalculateTeamAward(gentity_t *ent) { int teamAwards = 0; diff --git a/game/g_luaweapon.cpp b/game/g_luaweapon.cpp index be3fe01..4254171 100644 --- a/game/g_luaweapon.cpp +++ b/game/g_luaweapon.cpp @@ -16,7 +16,7 @@ namespace JPLua { std::unordered_map weaponCallbacks; #endif // JPLUA -qboolean Weapon_CallFunction(gentity_t *ent, weapon_t type, qboolean altFire) { +qboolean Weapon_CallFunction(gentity_t *ent, weapon_e type, qboolean altFire) { #ifdef JPLUA luaWeapon_t *handle = &weaponCallbacks[type]; if (altFire) { @@ -41,7 +41,7 @@ qboolean Weapon_CallFunction(gentity_t *ent, weapon_t type, qboolean altFire) { #ifdef JPLUA int Weapon_SetFireFunction(lua_State *L) { - weapon_t type = (weapon_t)luaL_checkinteger(L, 1); + weapon_e type = (weapon_e)luaL_checkinteger(L, 1); luaWeapon_t *handle = &weaponCallbacks[type]; if (lua_type(L, 2) != LUA_TFUNCTION) { return 0; @@ -58,7 +58,7 @@ int Weapon_SetFireFunction(lua_State *L) { } int Weapon_SetAltFireFunction(lua_State *L) { - weapon_t type = (weapon_t)luaL_checkinteger(L, 1); + weapon_e type = (weapon_e)luaL_checkinteger(L, 1); luaWeapon_t *handle = &weaponCallbacks[type]; if (lua_type(L, 2) != LUA_TFUNCTION) { return 0; diff --git a/game/g_luaweapon.h b/game/g_luaweapon.h index a849622..ae18ede 100644 --- a/game/g_luaweapon.h +++ b/game/g_luaweapon.h @@ -15,6 +15,6 @@ int Weapon_SetAltFireFunction(lua_State *L); #endif // JPLUA -qboolean Weapon_CallFunction(gentity_t *ent, weapon_t type, qboolean altFire); +qboolean Weapon_CallFunction(gentity_t *ent, weapon_e type, qboolean altFire); } // namespace JPLua diff --git a/game/g_main.cpp b/game/g_main.cpp index 04e403c..1555a05 100644 --- a/game/g_main.cpp +++ b/game/g_main.cpp @@ -2558,7 +2558,7 @@ void WP_SaberStartMissileBlockCheck(gentity_t *self, usercmd_t *ucmd); qboolean G_PointInBounds(vector3 *point, vector3 *mins, vector3 *maxs); int g_siegeRespawnCheck = 0; -void SetMoverState(gentity_t *ent, moverState_t moverState, int time); +void SetMoverState(gentity_t *ent, moverState_e moverState, int time); // Advances the non-player objects in the world void G_RunFrame(int levelTime) { @@ -2623,7 +2623,7 @@ void G_RunFrame(int levelTime) { if (useDif > 1.0f) { useDif = 1.0f; } - trap->Cvar_Set("timescale", va("%f", useDif)); + trap->Cvar_Set("timescale", va("%f", (double)useDif)); } else { char buf[128]; float tFVal = 0; @@ -2678,7 +2678,7 @@ void G_RunFrame(int levelTime) { } if (level.pause.state == PAUSE_PAUSED) { if (lastMsgTime < level.time - 500) { - G_Announce(va("Match has been paused.\n%.0f seconds remaining", ceilf((level.pause.time - level.time) / 1000.0f))); + G_Announce(va("Match has been paused.\n%.0f seconds remaining", (double)ceilf((level.pause.time - level.time) / 1000.0f))); lastMsgTime = level.time; } @@ -2687,7 +2687,7 @@ void G_RunFrame(int levelTime) { } if (level.pause.state == PAUSE_UNPAUSING) { if (lastMsgTime < level.time - 500) { - G_Announce(va("MATCH IS UNPAUSING\nin %.0f...", ceilf((level.pause.time - level.time) / 1000.0f))); + G_Announce(va("MATCH IS UNPAUSING\nin %.0f...", (double)ceilf((level.pause.time - level.time) / 1000.0f))); lastMsgTime = level.time; } @@ -3368,7 +3368,7 @@ Q_CABI { return 0; case GAME_GETITEMINDEXBYTAG: - return BG_GetItemIndexByTag(arg0, (itemType_t)arg1); + return BG_GetItemIndexByTag(arg0, (itemType_e)arg1); default: break; diff --git a/game/g_misc.cpp b/game/g_misc.cpp index 0c6a5cd..025c284 100644 --- a/game/g_misc.cpp +++ b/game/g_misc.cpp @@ -463,12 +463,12 @@ void SP_terrain(gentity_t *ent) { Info_SetValueForKey(temp, "terxels", va("%d", atoi(value))); Info_SetValueForKey(temp, "seed", seed); - Info_SetValueForKey(temp, "minx", va("%f", ent->r.mins.x)); - Info_SetValueForKey(temp, "miny", va("%f", ent->r.mins.y)); - Info_SetValueForKey(temp, "minz", va("%f", ent->r.mins.z)); - Info_SetValueForKey(temp, "maxx", va("%f", ent->r.maxs.x)); - Info_SetValueForKey(temp, "maxy", va("%f", ent->r.maxs.y)); - Info_SetValueForKey(temp, "maxz", va("%f", ent->r.maxs.z)); + Info_SetValueForKey(temp, "minx", va("%f", (double)ent->r.mins.x)); + Info_SetValueForKey(temp, "miny", va("%f", (double)ent->r.mins.y)); + Info_SetValueForKey(temp, "minz", va("%f", (double)ent->r.mins.z)); + Info_SetValueForKey(temp, "maxx", va("%f", (double)ent->r.maxs.x)); + Info_SetValueForKey(temp, "maxy", va("%f", (double)ent->r.maxs.y)); + Info_SetValueForKey(temp, "maxz", va("%f", (double)ent->r.maxs.z)); Info_SetValueForKey(temp, "modelIndex", va("%d", ent->s.modelindex)); @@ -591,8 +591,8 @@ void SP_misc_skyportal(gentity_t *ent) { isfog += G_SpawnInt("fognear", "0", &fogn); isfog += G_SpawnInt("fogfar", "300", &fogf); - trap->SetConfigstring(CS_SKYBOXORG, va("%.2f %.2f %.2f %.1f %i %.2f %.2f %.2f %i %i", ent->s.origin.x, ent->s.origin.y, ent->s.origin.z, fov_x, (int)isfog, - fogv.x, fogv.y, fogv.z, fogn, fogf)); + trap->SetConfigstring(CS_SKYBOXORG, va("%.2f %.2f %.2f %.1f %i %.2f %.2f %.2f %i %i", (double)ent->s.origin.x, (double)ent->s.origin.y, + (double)ent->s.origin.z, (double)fov_x, (int)isfog, (double)fogv.x, (double)fogv.y, (double)fogv.z, fogn, fogf)); ent->think = G_PortalifyEntities; ent->nextthink = level.time + 1050; // give it some time first so that all other entities are spawned. @@ -967,7 +967,7 @@ void InitShooter(gentity_t *ent, int weapon) { ent->use = Use_Shooter; ent->s.weapon = weapon; - RegisterItem(BG_FindItemForWeapon((weapon_t)weapon)); + RegisterItem(BG_FindItemForWeapon((weapon_e)weapon)); G_SetMovedir(&ent->s.angles, &ent->movedir); @@ -1944,7 +1944,7 @@ void SP_CreateWind(gentity_t *ent) { G_SpawnFloat("speed", "500", &ent->speed); VectorScale(&windDir, ent->speed, &windDir); - Com_sprintf(tmp, sizeof(tmp), "*constantwind ( %f %f %f )", windDir.x, windDir.y, windDir.z); + Com_sprintf(tmp, sizeof(tmp), "*constantwind ( %f %f %f )", (double)windDir.x, (double)windDir.y, (double)windDir.z); G_EffectIndex(tmp); } @@ -2775,7 +2775,7 @@ void SP_misc_weapon_shooter(gentity_t *self) { self->s.weapon = self->client->ps.weapon = GetIDForString(WPTable, s); } - RegisterItem(BG_FindItemForWeapon((weapon_t)self->s.weapon)); + RegisterItem(BG_FindItemForWeapon((weapon_e)self->s.weapon)); // set where our muzzle is VectorCopy(&self->s.origin, &self->client->renderInfo.muzzlePoint); diff --git a/game/g_missile.cpp b/game/g_missile.cpp index 86efde0..905bf78 100644 --- a/game/g_missile.cpp +++ b/game/g_missile.cpp @@ -28,7 +28,7 @@ void G_ReflectMissile(gentity_t *ent, gentity_t *missile, vector3 *forward) { speed = VectorNormalize(&missile->s.pos.trDelta); // if ( ent && owner && owner->NPC && owner->enemy && Q_stricmp( "Tavion", owner->NPC_type ) == 0 && Q_irand( 0, 3 ) ) - if (&g_entities[missile->r.ownerNum] && missile->s.weapon != WP_SABER && missile->s.weapon != G2_MODEL_PART && !isowner) { // bounce back at them if you can + if (g_entities[missile->r.ownerNum].inuse && missile->s.weapon != WP_SABER && missile->s.weapon != G2_MODEL_PART && !isowner) { // bounce back at them if you can VectorSubtract(&g_entities[missile->r.ownerNum].r.currentOrigin, &missile->r.currentOrigin, &bounce_dir); VectorNormalize(&bounce_dir); } else if (isowner) { // in this case, actually push the missile away from me, and since we're giving boost to our own missile by pushing it, up the @@ -527,7 +527,7 @@ void G_MissileImpact(gentity_t *ent, trace_t *trace) { } if (didDmg && other && other->client) { // What I'm wondering is why this isn't in the NPC pain funcs. But this is what SP does, so whatever. - class_t npc_class = other->client->NPC_class; + class_e npc_class = other->client->NPC_class; // If we are a robot and we aren't currently doing the full body electricity... if (npc_class == CLASS_SEEKER || npc_class == CLASS_PROBE || npc_class == CLASS_MOUSE || npc_class == CLASS_GONK || npc_class == CLASS_R2D2 || diff --git a/game/g_mover.cpp b/game/g_mover.cpp index d3c6e88..fe7879f 100644 --- a/game/g_mover.cpp +++ b/game/g_mover.cpp @@ -422,7 +422,7 @@ void CalcTeamDoorCenter(gentity_t *ent, vector3 *center) { } } -void SetMoverState(gentity_t *ent, moverState_t moverState, int time) { +void SetMoverState(gentity_t *ent, moverState_e moverState, int time) { vector3 delta; float f; @@ -473,7 +473,7 @@ void SetMoverState(gentity_t *ent, moverState_t moverState, int time) { } // All entities in a mover team will move from pos1 to pos2 in the same amount of time -void MatchTeam(gentity_t *teamLeader, moverState_t moverState, int time) { +void MatchTeam(gentity_t *teamLeader, moverState_e moverState, int time) { gentity_t *slave; for (slave = teamLeader; slave; slave = slave->teamchain) { @@ -1952,7 +1952,7 @@ void funcBBrushDieGo(gentity_t *self) { if (self->radius > 0.0f) { // designer wants to scale number of chunks, helpful because the above scale code is far from perfect // I do this after the scale calculation because it seems that the chunk size generally seems to be very close, it's just the number of chunks is a - //bit weak + // bit weak numChunks *= self->radius; } @@ -2060,7 +2060,7 @@ void funcBBrushPain(gentity_t *self, gentity_t *attacker, int damage) { if (self->radius > 0.0f) { // designer wants to scale number of chunks, helpful because the above scale code is far from perfect // I do this after the scale calculation because it seems that the chunk size generally seems to be very close, it's just the number of chunks is a - //bit weak + // bit weak numChunks = ceilf(numChunks * self->radius); } G_Chunks(self->s.number, &org, &dir, &self->r.absmin, &self->r.absmax, 300, numChunks, self->material, 0, (scale * self->mass)); diff --git a/game/g_nav.cpp b/game/g_nav.cpp index c1d6d0f..6b815a0 100644 --- a/game/g_nav.cpp +++ b/game/g_nav.cpp @@ -202,7 +202,7 @@ qboolean NAV_ClearPathToPoint(gentity_t *self, vector3 *pmins, vector3 *pmaxs, v return qtrue; } else { if (NAVDEBUG_showCollision) { - if (trace.entityNum < ENTITYNUM_WORLD && (&g_entities[trace.entityNum] != NULL) && g_entities[trace.entityNum].s.eType != ET_MOVER) { + if (trace.entityNum < ENTITYNUM_WORLD && (g_entities[trace.entityNum].inuse) && g_entities[trace.entityNum].s.eType != ET_MOVER) { vector3 p1, p2; // G_DrawEdge( point, trace.endpos, EDGE_PATH ); VectorAdd(&g_entities[trace.entityNum].r.mins, &g_entities[trace.entityNum].r.currentOrigin, &p1); @@ -228,7 +228,7 @@ qboolean NAV_ClearPathToPoint(gentity_t *self, vector3 *pmins, vector3 *pmaxs, v } if (NAVDEBUG_showCollision) { - if (trace.entityNum < ENTITYNUM_WORLD && (&g_entities[trace.entityNum] != NULL) && g_entities[trace.entityNum].s.eType != ET_MOVER) { + if (trace.entityNum < ENTITYNUM_WORLD && (g_entities[trace.entityNum].inuse) && g_entities[trace.entityNum].s.eType != ET_MOVER) { vector3 p1, p2; // G_DrawEdge( self->r.currentOrigin, trace.endpos, EDGE_PATH ); VectorAdd(&g_entities[trace.entityNum].r.mins, &g_entities[trace.entityNum].r.currentOrigin, &p1); diff --git a/game/g_public.h b/game/g_public.h index 37a1562..0f3ff1c 100644 --- a/game/g_public.h +++ b/game/g_public.h @@ -95,8 +95,7 @@ typedef struct entityShared_s { } entityShared_t; // bstate.h -typedef enum // # bState_e -{ // These take over only if script allows them to be autonomous +enum bState_e { // These take over only if script allows them to be autonomous BS_DEFAULT = 0, // # default behavior for that NPC BS_ADVANCE_FIGHT, // # Advance to captureGoal and shoot enemies if you can BS_SLEEP, // # Play awake script when startled by sound @@ -107,9 +106,9 @@ typedef enum // # bState_e BS_NOCLIP, // # Moves through walls, etc. BS_REMOVE, // # Waits for player to leave PVS then removes itself BS_CINEMATIC, // # Does nothing but face it's angles and move to a goal if it has one - // # #eol - // internal bStates only - BS_WAIT, // # Does nothing but face it's angles + // # #eol + // internal bStates only + BS_WAIT, // # Does nothing but face it's angles BS_STAND_GUARD, BS_PATROL, BS_INVESTIGATE, // # head towards temp goal and look for enemies and listen for sounds @@ -117,34 +116,34 @@ typedef enum // # bState_e BS_HUNT_AND_KILL, BS_FLEE, // # Run away! NUM_BSTATES -} bState_t; +}; -enum { EDGE_NORMAL, EDGE_PATH, EDGE_BLOCKED, EDGE_FAILED, EDGE_MOVEDIR }; +enum navEdgeDrawType_e { EDGE_NORMAL, EDGE_PATH, EDGE_BLOCKED, EDGE_FAILED, EDGE_MOVEDIR }; -enum { +enum navNodeDrawType_e { NODE_NORMAL, NODE_START, NODE_GOAL, NODE_NAVGOAL, }; -typedef enum // # taskID_e -{ TID_CHAN_VOICE = 0, // Waiting for a voice sound to complete - TID_ANIM_UPPER, // Waiting to finish a lower anim holdtime - TID_ANIM_LOWER, // Waiting to finish a lower anim holdtime - TID_ANIM_BOTH, // Waiting to finish lower and upper anim holdtimes or normal md3 animating - TID_MOVE_NAV, // Trying to get to a navgoal or For ET_MOVERS - TID_ANGLE_FACE, // Turning to an angle or facing - TID_BSTATE, // Waiting for a certain bState to finish - TID_LOCATION, // Waiting for ent to enter a specific trigger_location - // TID_MISSIONSTATUS, // Waiting for player to finish reading MISSION STATUS SCREEN - TID_RESIZE, // Waiting for clear bbox to inflate size - TID_SHOOT, // Waiting for fire event - NUM_TIDS, // for def of taskID array -} taskID_t; - -typedef enum // # bSet_e -{ // This should check to matching a behavior state name first, then look for a script +enum taskID_e { + TID_CHAN_VOICE = 0, // Waiting for a voice sound to complete + TID_ANIM_UPPER, // Waiting to finish a lower anim holdtime + TID_ANIM_LOWER, // Waiting to finish a lower anim holdtime + TID_ANIM_BOTH, // Waiting to finish lower and upper anim holdtimes or normal md3 animating + TID_MOVE_NAV, // Trying to get to a navgoal or For ET_MOVERS + TID_ANGLE_FACE, // Turning to an angle or facing + TID_BSTATE, // Waiting for a certain bState to finish + TID_LOCATION, // Waiting for ent to enter a specific trigger_location + // TID_MISSIONSTATUS, // Waiting for player to finish reading MISSION STATUS SCREEN + TID_RESIZE, // Waiting for clear bbox to inflate size + TID_SHOOT, // Waiting for fire event + NUM_TIDS, // for def of taskID array +}; + +enum bSet_e { + // This should check to matching a behavior state name first, then look for a script BSET_INVALID = -1, BSET_FIRST = 0, BSET_SPAWN = 0, // # script to use when first spawned @@ -166,7 +165,7 @@ typedef enum // # bSet_e BSET_MINDTRICK, // # script to run when player does a mind trick on this NPC NUM_BSETS -} bSet_t; +}; #define MAX_PARMS 16 #define MAX_PARM_STRING_LENGTH MAX_QPATH // was 16, had to lengthen it so they could take a valid file path @@ -323,7 +322,7 @@ typedef struct T_G_ICARUS_GETSETIDFORSTRING_s { char string[2048]; } T_G_ICARUS_GETSETIDFORSTRING; -typedef enum gameImportLegacy_e { +enum gameImportLegacy_e { G_PRINT, G_ERROR, G_MILLISECONDS, @@ -709,9 +708,9 @@ typedef enum gameImportLegacy_e { G_BOT_UPDATEWAYPOINTS, G_BOT_CALCULATEPATHS -} gameImportLegacy_t; +}; -typedef enum gameExportLegacy_e { +enum gameExportLegacy_e { GAME_INIT, GAME_SHUTDOWN, GAME_CLIENT_CONNECT, @@ -753,7 +752,7 @@ typedef enum gameExportLegacy_e { GAME_NAV_FINDCOMBATPOINTWAYPOINTS, GAME_GETITEMINDEXBYTAG -} gameExportLegacy_t; +}; typedef struct gameImport_s { // misc @@ -1148,5 +1147,5 @@ typedef struct gameExport_s { qboolean (*NAV_EntIsBreakable)(int entityNum); qboolean (*NAV_EntIsRemovableUsable)(int entNum); void (*NAV_FindCombatPointWaypoints)(void); - int (*BG_GetItemIndexByTag)(int tag, itemType_t type); + int (*BG_GetItemIndexByTag)(int tag, itemType_e type); } gameExport_t; diff --git a/game/g_saga.cpp b/game/g_saga.cpp index 05deb64..382c62d 100644 --- a/game/g_saga.cpp +++ b/game/g_saga.cpp @@ -51,14 +51,14 @@ void G_SiegeRegisterWeaponsAndHoldables(int team) { int j = 0; while (j < WP_NUM_WEAPONS) { if (scl->weapons & (1 << j)) { // we use this weapon so register it. - RegisterItem(BG_FindItemForWeapon((weapon_t)j)); + RegisterItem(BG_FindItemForWeapon((weapon_e)j)); } j++; } j = 0; while (j < HI_NUM_HOLDABLE) { if (scl->invenItems & (1 << j)) { // we use this item so register it. - RegisterItem(BG_FindItemForHoldable((holdable_t)j)); + RegisterItem(BG_FindItemForHoldable((holdable_e)j)); } j++; } @@ -617,7 +617,7 @@ void SetTeamQuick(gentity_t *ent, int team, qboolean doBegin) { G_ValidateSiegeClassForTeam(ent, team); } - ent->client->sess.sessionTeam = (team_t)team; + ent->client->sess.sessionTeam = (team_e)team; if (team == TEAM_SPECTATOR) { ent->client->sess.spectatorState = SPECTATOR_FREE; diff --git a/game/g_session.cpp b/game/g_session.cpp index 92089bd..037d6cb 100644 --- a/game/g_session.cpp +++ b/game/g_session.cpp @@ -85,13 +85,13 @@ void G_ReadClientSessionData(gclient_t *client) { } if ((object = cJSON_GetObjectItem(root, "sessionTeam"))) { - sess->sessionTeam = (team_t)object->valueint; + sess->sessionTeam = (team_e)object->valueint; } if ((object = cJSON_GetObjectItem(root, "spectatorTime"))) { sess->spectatorTime = object->valueint; } if ((object = cJSON_GetObjectItem(root, "spectatorState"))) { - sess->spectatorState = (spectatorState_t)object->valueint; + sess->spectatorState = (spectatorState_e)object->valueint; } if ((object = cJSON_GetObjectItem(root, "spectatorClient"))) { sess->spectatorClient = object->valueint; diff --git a/game/g_spawn.cpp b/game/g_spawn.cpp index 3ad1d47..8b482b6 100644 --- a/game/g_spawn.cpp +++ b/game/g_spawn.cpp @@ -1025,16 +1025,16 @@ static void HandleEntityAdjustment(void) { newOrigin.z = origin.z; VectorAdd(&newOrigin, &level.mOriginAdjust, &newOrigin); // damn VMs don't handle outputing a float that is compatible with sscanf in all cases - Com_sprintf(temp, MAX_QPATH, "%0.0f %0.0f %0.0f", newOrigin.x, newOrigin.y, newOrigin.z); + Com_sprintf(temp, MAX_QPATH, "%0.0f %0.0f %0.0f", (double)newOrigin.x, (double)newOrigin.y, (double)newOrigin.z); AddSpawnField("origin", temp); G_SpawnString("angles", NOVALUE, &value); if (Q_stricmp(value, NOVALUE) != 0) { sscanf(value, "%f %f %f", &angles.x, &angles.y, &angles.z); - angles.yaw = fmod(angles.y + level.mRotationAdjust, 360.0f); + angles.yaw = fmodf(angles.y + level.mRotationAdjust, 360.0f); // damn VMs don't handle outputing a float that is compatible with sscanf in all cases - Com_sprintf(temp, MAX_QPATH, "%0.0f %0.0f %0.0f", angles.x, angles.y, angles.z); + Com_sprintf(temp, MAX_QPATH, "%0.0f %0.0f %0.0f", (double)angles.x, (double)angles.y, (double)angles.z); AddSpawnField("angles", temp); } else { G_SpawnString("angle", NOVALUE, &value); @@ -1043,8 +1043,8 @@ static void HandleEntityAdjustment(void) { } else { angles.y = 0.0f; } - angles.y = fmod(angles.y + level.mRotationAdjust, 360.0f); - Com_sprintf(temp, MAX_QPATH, "%0.0f", angles.y); + angles.y = fmodf(angles.y + level.mRotationAdjust, 360.0f); + Com_sprintf(temp, MAX_QPATH, "%0.0f", (double)angles.y); AddSpawnField("angle", temp); } @@ -1056,8 +1056,8 @@ static void HandleEntityAdjustment(void) { } else { angles.x = angles.y = angles.z = 0.0f; } - angles.y = fmod(angles.y + level.mRotationAdjust, 360.0f); - Com_sprintf(temp, MAX_QPATH, "%0.0f %0.0f %0.0f", angles.x, angles.y, angles.z); + angles.y = fmodf(angles.y + level.mRotationAdjust, 360.0f); + Com_sprintf(temp, MAX_QPATH, "%0.0f %0.0f %0.0f", (double)angles.x, (double)angles.y, (double)angles.z); AddSpawnField("direction", temp); AddSpawnField("BSPInstanceID", level.mTargetAdjust); diff --git a/game/g_team.cpp b/game/g_team.cpp index 0da66d1..f667b89 100644 --- a/game/g_team.cpp +++ b/game/g_team.cpp @@ -674,7 +674,7 @@ int Team_TouchOurFlag(gentity_t *ent, gentity_t *other, int team) { if (teamgame.bestCapTime == -1) { trap->SendServerCommand(-1, va("print \"%s " S_COLOR_GREEN "captured the %s flag in " S_COLOR_CYAN "%.3f " S_COLOR_GREEN "seconds, setting the record\n\"", - cl->pers.netname, TeamName(OtherTeam(team)), capTime / 1000.0f)); + cl->pers.netname, TeamName(OtherTeam(team)), (double)(capTime / 1000.0f))); teamgame.bestCapTime = capTime; Q_strncpyz(teamgame.bestCapName, cl->pers.netname, sizeof(teamgame.bestCapName)); } else if (capTime < teamgame.bestCapTime) { @@ -682,14 +682,14 @@ int Team_TouchOurFlag(gentity_t *ent, gentity_t *other, int team) { trap->SendServerCommand(-1, va("print \"%s " S_COLOR_GREEN "captured the %s flag in " S_COLOR_CYAN "%.3f " S_COLOR_GREEN "seconds, breaking their record of " S_COLOR_CYAN "%.3f " S_COLOR_GREEN "seconds (" S_COLOR_YELLOW "+%.3f" S_COLOR_GREEN ")\n\"", - cl->pers.netname, TeamName(OtherTeam(team)), capTime / 1000.0f, teamgame.bestCapTime / 1000.0f, - (teamgame.bestCapTime - capTime) / 1000.0f)); + cl->pers.netname, TeamName(OtherTeam(team)), (double)(capTime / 1000.0f), + (double)(teamgame.bestCapTime / 1000.0f), (double)((teamgame.bestCapTime - capTime) / 1000.0f))); else { trap->SendServerCommand(-1, va("print \"%s " S_COLOR_GREEN "captured the %s flag in " S_COLOR_CYAN "%.3f " S_COLOR_GREEN "seconds, breaking %s" S_COLOR_GREEN "'s record of " S_COLOR_CYAN "%.3f " S_COLOR_GREEN "seconds (" S_COLOR_YELLOW "+%.3f" S_COLOR_GREEN ")\n\"", - cl->pers.netname, TeamName(OtherTeam(team)), capTime / 1000.0f, teamgame.bestCapName, - teamgame.bestCapTime / 1000.0f, (teamgame.bestCapTime - capTime) / 1000.0f)); + cl->pers.netname, TeamName(OtherTeam(team)), (double)(capTime / 1000.0f), teamgame.bestCapName, + (double)(teamgame.bestCapTime / 1000.0f), (double)((teamgame.bestCapTime - capTime) / 1000.0f))); } teamgame.bestCapTime = capTime; Q_strncpyz(teamgame.bestCapName, cl->pers.netname, sizeof(teamgame.bestCapName)); @@ -698,14 +698,14 @@ int Team_TouchOurFlag(gentity_t *ent, gentity_t *other, int team) { trap->SendServerCommand(-1, va("print \"%s " S_COLOR_GREEN "captured the %s flag in " S_COLOR_CYAN "%.3f " S_COLOR_GREEN "seconds, failing to break their record of " S_COLOR_CYAN "%.3f " S_COLOR_GREEN "seconds (" S_COLOR_RED "%.3f" S_COLOR_GREEN ")\n\"", - cl->pers.netname, TeamName(OtherTeam(team)), capTime / 1000.0f, teamgame.bestCapTime / 1000.0f, - (teamgame.bestCapTime - capTime) / 1000.0f)); + cl->pers.netname, TeamName(OtherTeam(team)), (double)(capTime / 1000.0f), + (double)(teamgame.bestCapTime / 1000.0f), (double)((teamgame.bestCapTime - capTime) / 1000.0f))); } else { trap->SendServerCommand(-1, va("print \"%s " S_COLOR_GREEN "captured the %s flag in " S_COLOR_CYAN "%.3f " S_COLOR_GREEN "seconds, failing to break %s" S_COLOR_GREEN "'s record of " S_COLOR_CYAN "%.3f " S_COLOR_GREEN "seconds (" S_COLOR_RED "%.3f" S_COLOR_GREEN ")\n\"", - cl->pers.netname, TeamName(OtherTeam(team)), capTime / 1000.0f, teamgame.bestCapName, - teamgame.bestCapTime / 1000.0f, (teamgame.bestCapTime - capTime) / 1000.0f)); + cl->pers.netname, TeamName(OtherTeam(team)), (double)(capTime / 1000.0f), teamgame.bestCapName, + (double)(teamgame.bestCapTime / 1000.0f), (double)((teamgame.bestCapTime - capTime) / 1000.0f))); } } } else { @@ -917,7 +917,7 @@ qboolean Team_GetLocationMsg(gentity_t *ent, char *loc, int loclen) { #define MAX_TEAM_SPAWN_POINTS 32 // go to a random point that doesn't telefrag -gentity_t *SelectRandomTeamSpawnPoint(int teamstate, team_t team, int siegeClass) { +gentity_t *SelectRandomTeamSpawnPoint(int teamstate, team_e team, int siegeClass) { gentity_t *spot, *spots[MAX_TEAM_SPAWN_POINTS]; int count, selection; const char *classname; @@ -994,7 +994,7 @@ gentity_t *SelectRandomTeamSpawnPoint(int teamstate, team_t team, int siegeClass return spots[selection]; } -gentity_t *SelectCTFSpawnPoint(team_t team, int teamstate, vector3 *origin, vector3 *angles) { +gentity_t *SelectCTFSpawnPoint(team_e team, int teamstate, vector3 *origin, vector3 *angles) { gentity_t *spot; spot = SelectRandomTeamSpawnPoint(teamstate, team, -1); @@ -1010,7 +1010,7 @@ gentity_t *SelectCTFSpawnPoint(team_t team, int teamstate, vector3 *origin, vect return spot; } -gentity_t *SelectSiegeSpawnPoint(int siegeClass, team_t team, int teamstate, vector3 *origin, vector3 *angles) { +gentity_t *SelectSiegeSpawnPoint(int siegeClass, team_e team, int teamstate, vector3 *origin, vector3 *angles) { gentity_t *spot; spot = SelectRandomTeamSpawnPoint(teamstate, team, siegeClass); diff --git a/game/g_team.h b/game/g_team.h index 31ca109..9ef4af2 100644 --- a/game/g_team.h +++ b/game/g_team.h @@ -40,8 +40,8 @@ void Team_CheckHurtCarrier(gentity_t *targ, gentity_t *attacker); void Team_InitGame(void); void Team_ReturnFlag(int team); void Team_FreeEntity(gentity_t *ent); -gentity_t *SelectCTFSpawnPoint(team_t team, int teamstate, vector3 *origin, vector3 *angles); -gentity_t *SelectSiegeSpawnPoint(int siegeClass, team_t team, int teamstate, vector3 *origin, vector3 *angles); +gentity_t *SelectCTFSpawnPoint(team_e team, int teamstate, vector3 *origin, vector3 *angles); +gentity_t *SelectSiegeSpawnPoint(int siegeClass, team_e team, int teamstate, vector3 *origin, vector3 *angles); gentity_t *Team_GetLocation(gentity_t *ent); qboolean Team_GetLocationMsg(gentity_t *ent, char *loc, int loclen); void TeamplayInfoMessage(gentity_t *ent); diff --git a/game/g_utils.cpp b/game/g_utils.cpp index da78a5c..41bfb45 100644 --- a/game/g_utils.cpp +++ b/game/g_utils.cpp @@ -49,7 +49,7 @@ const char *BuildShaderStateConfig(void) { memset(buf, 0, MAX_STRING_CHARS); for (i = 0; i < remapCount; i++) { - Com_sprintf(out, sizeof(out), "%s=%s:%5.2f@", remappedShaders[i].oldShader, remappedShaders[i].newShader, remappedShaders[i].timeOffset); + Com_sprintf(out, sizeof(out), "%s=%s:%5.2f@", remappedShaders[i].oldShader, remappedShaders[i].newShader, (double)remappedShaders[i].timeOffset); Q_strcat(buf, sizeof(buf), out); } @@ -103,7 +103,7 @@ int G_EffectIndex(const char *name) { return G_FindConfigstringIndex(name, CS_EF int G_BSPIndex(const char *name) { return G_FindConfigstringIndex(name, CS_BSP_MODELS, MAX_SUB_BSP, qtrue); } -void G_TeamCommand(team_t team, const char *cmd) { +void G_TeamCommand(team_e team, const char *cmd) { int i = 0; gclient_t *cl = NULL; @@ -969,7 +969,7 @@ int G_CanUseDispOn(gentity_t *ent, int dispType) { // otherwise no return 0; } else if (dispType == HI_AMMODISP) { - ammo_t ammoIndex = weaponData[ent->client->ps.weapon].ammoIndex; + ammo_e ammoIndex = weaponData[ent->client->ps.weapon].ammoIndex; if (ent->client->ps.weapon <= WP_NONE || ent->client->ps.weapon > LAST_USEABLE_WEAPON) { return 0; } @@ -1857,7 +1857,7 @@ bool G_CheckDuelIsolationSkip(const gentity_t *e1, const gentity_t *e2) { return true; } -ammo_t G_AmmoForWeapon(weapon_t weapon) { +ammo_e G_AmmoForWeapon(weapon_e weapon) { if (weapon < WP_NONE || weapon >= WP_NUM_WEAPONS) { return AMMO_NONE; } diff --git a/game/g_vehicles.cpp b/game/g_vehicles.cpp index 6dd6ec8..f6c1a2c 100644 --- a/game/g_vehicles.cpp +++ b/game/g_vehicles.cpp @@ -1402,7 +1402,7 @@ static qboolean UpdateRider(Vehicle_t *pVeh, bgEntity_t *pRider, usercmd_t *pUmc // If going too fast, roll off. if ((parent->client->ps.speed <= 600) && pUmcd->rightmove != 0) { if (pVeh->m_pVehicleInfo->Eject(pVeh, pRider, qfalse)) { - animNumber_t Anim; + animNumber_e Anim; int iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD | SETANIM_FLAG_HOLDLESS, iBlend = 300; if (pUmcd->rightmove > 0) { Anim = BOTH_ROLL_R; @@ -1421,7 +1421,7 @@ static qboolean UpdateRider(Vehicle_t *pVeh, bgEntity_t *pRider, usercmd_t *pUmc } } else { // FIXME: Check trace to see if we should start playing the animation. - animNumber_t Anim; + animNumber_e Anim; int iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD, iBlend = 500; if (pUmcd->rightmove > 0) { Anim = BOTH_VS_DISMOUNT_R; @@ -1487,7 +1487,7 @@ static qboolean UpdateRider(Vehicle_t *pVeh, bgEntity_t *pRider, usercmd_t *pUmc // Roll off. if (pUmcd->upmove < 0) { - animNumber_t Anim = BOTH_ROLL_B; + animNumber_e Anim = BOTH_ROLL_B; pVeh->m_EjectDir = VEH_EJECT_REAR; if (pUmcd->rightmove > 0) { Anim = BOTH_ROLL_R; diff --git a/game/g_weapon.cpp b/game/g_weapon.cpp index d31072e..0f8ea56 100644 --- a/game/g_weapon.cpp +++ b/game/g_weapon.cpp @@ -354,7 +354,7 @@ static void WP_FireBlaster(gentity_t *ent, qboolean altFire) { WP_FireBlasterMissile(ent, &muzzle, &dir, altFire); } -hitLocation_t G_GetHitLocation(gentity_t *target, vector3 *ppoint); +hitLocation_e G_GetHitLocation(gentity_t *target, vector3 *ppoint); static void WP_DisruptorMainFire(gentity_t *ent) { int damage = DISRUPTOR_MAIN_DAMAGE; @@ -2393,7 +2393,7 @@ void WP_DropDetPack(gentity_t *ent, qboolean alt_fire) { } if (removeMe != -1) { // remove it... or blow it? - if (&g_entities[foundDetPacks[removeMe]] == NULL) { + if (!g_entities[foundDetPacks[removeMe]].inuse) { break; } else { G_FreeEntity(&g_entities[foundDetPacks[removeMe]]); @@ -3705,7 +3705,7 @@ void FireWeapon(gentity_t *ent, qboolean altFire) { CalcMuzzlePoint(ent, &forward, &vright, &up, &muzzle); // fire the specific weapon - if (JPLua::Weapon_CallFunction(ent, (weapon_t)ent->s.weapon, altFire)) { + if (JPLua::Weapon_CallFunction(ent, (weapon_e)ent->s.weapon, altFire)) { // jplua override return; } diff --git a/game/g_xcvar.h b/game/g_xcvar.h index 153bfb6..ba8cdd1 100644 --- a/game/g_xcvar.h +++ b/game/g_xcvar.h @@ -22,9 +22,7 @@ XCVAR_DEF(d_asynchronousGroupAI, "0", NULL, CVAR_CHEAT, qfalse) XCVAR_DEF(d_JediAI, "0", NULL, CVAR_CHEAT, qfalse) XCVAR_DEF(d_noGroupAI, "0", NULL, CVAR_CHEAT, qfalse) XCVAR_DEF(d_noIntermissionWait, "0", NULL, CVAR_NONE, qfalse) -XCVAR_DEF(d_noroam, "0", NULL, CVAR_CHEAT, qfalse) XCVAR_DEF(d_npcai, "0", NULL, CVAR_CHEAT, qfalse) -XCVAR_DEF(d_npcaiming, "0", NULL, CVAR_CHEAT, qfalse) XCVAR_DEF(d_npcfreeze, "0", NULL, CVAR_CHEAT, qfalse) XCVAR_DEF(d_patched, "0", NULL, CVAR_CHEAT, qfalse) XCVAR_DEF(d_perPlayerGhoul2, "0", NULL, CVAR_CHEAT, qtrue) @@ -32,7 +30,6 @@ XCVAR_DEF(d_powerDuelPrint, "0", NULL, CVAR_NONE, qtrue) XCVAR_DEF(d_projectileGhoul2Collision, "1", NULL, CVAR_NONE, qtrue) XCVAR_DEF(d_saberAlwaysBoxTrace, "0", NULL, CVAR_ARCHIVE, qtrue) XCVAR_DEF(d_saberBoxTraceSize, "0", NULL, CVAR_ARCHIVE, qtrue) -XCVAR_DEF(d_saberCombat, "0", NULL, CVAR_CHEAT, qfalse) XCVAR_DEF(d_saberGhoul2Collision, "1", NULL, CVAR_ARCHIVE, qtrue) XCVAR_DEF(d_saberInterpolate, "0", NULL, CVAR_ARCHIVE, qtrue) XCVAR_DEF(d_saberKickTweak, "1", NULL, CVAR_NONE, qtrue) @@ -110,10 +107,8 @@ XCVAR_DEF(g_privateDuelShield, "100", NULL, CVAR_ARCHIVE, qtrue) XCVAR_DEF(g_restarted, "0", NULL, CVAR_ROM, qfalse) XCVAR_DEF(g_saberBladeFaces, "1", NULL, CVAR_NONE, qtrue) XCVAR_DEF(g_saberDamageScale, "1", NULL, CVAR_ARCHIVE, qtrue) -#ifdef DEBUG_SABER_BOX -XCVAR_DEF(g_saberDebugBox, "0", NULL, CVAR_CHEAT, qfalse) -#endif -XCVAR_DEF(g_saberDebugPrint, "0", NULL, CVAR_CHEAT, qfalse) +XCVAR_DEF(g_saberDebugBox, "0", NULL, CVAR_ARCHIVE, qfalse) +XCVAR_DEF(g_saberDebugPrint, "0", NULL, CVAR_ARCHIVE, qfalse) XCVAR_DEF(g_saberDmgDelay_Idle, "350", NULL, CVAR_ARCHIVE, qtrue) XCVAR_DEF(g_saberDmgDelay_Wound, "0", NULL, CVAR_ARCHIVE, qtrue) XCVAR_DEF(g_saberDmgVelocityScale, "0", NULL, CVAR_ARCHIVE, qtrue) diff --git a/game/say.h b/game/say.h deleted file mode 100644 index f8f4447..0000000 --- a/game/say.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -typedef enum saying_e { - // Acknowledge command - SAY_ACKCOMM1, - SAY_ACKCOMM2, - SAY_ACKCOMM3, - SAY_ACKCOMM4, - // Refuse command - SAY_REFCOMM1, - SAY_REFCOMM2, - SAY_REFCOMM3, - SAY_REFCOMM4, - // Bad command - SAY_BADCOMM1, - SAY_BADCOMM2, - SAY_BADCOMM3, - SAY_BADCOMM4, - // Unfinished hail - SAY_BADHAIL1, - SAY_BADHAIL2, - SAY_BADHAIL3, - SAY_BADHAIL4, - //# #eol - NUM_SAYINGS -} saying_t; diff --git a/game/teams.h b/game/teams.h index 3a74622..1d37de2 100644 --- a/game/teams.h +++ b/game/teams.h @@ -1,17 +1,17 @@ #pragma once -typedef enum npcteam_e { - NPCTEAM_FREE, // also TEAM_FREE - caution, some code checks a team_t via "if (!team_t_varname)" so I guess this should stay as entry 0, great or what? -slc +enum npcteam_e { + NPCTEAM_FREE, // also TEAM_FREE - caution, some code checks a team_e via "if (!team_t_varname)" so I guess this should stay as entry 0, great or what? -slc NPCTEAM_ENEMY, // also TEAM_RED NPCTEAM_PLAYER, // also TEAM_BLUE NPCTEAM_NEUTRAL, // also TEAM_SPECTATOR - most droids are team_neutral, there are some exceptions like Probe,Seeker,Interrogator //# #eol NPCTEAM_NUM_TEAMS -} npcteam_t; +}; // This list is made up from the model directories, this MUST be in the same order as the ClassNames array in NPC_stats.cpp -typedef enum { +enum class_e { CLASS_NONE, // hopefully this will never be used by an npc, just covering all bases CLASS_ATST, // technically droid... CLASS_BARTENDER, @@ -70,4 +70,4 @@ typedef enum { CLASS_WAMPA, CLASS_NUM_CLASSES -} class_t; +}; diff --git a/game/vs14-server.vcxproj b/game/vs14-server.vcxproj index f1caa4d..d402ca9 100644 --- a/game/vs14-server.vcxproj +++ b/game/vs14-server.vcxproj @@ -181,7 +181,6 @@ - diff --git a/game/w_force.cpp b/game/w_force.cpp index e8e1151..32680e4 100644 --- a/game/w_force.cpp +++ b/game/w_force.cpp @@ -1800,7 +1800,7 @@ qboolean ForceTelepathyCheckDirectNPCTarget(gentity_t *self, trace_t *tr, qboole switch (traceEnt->client->NPC_class) { case CLASS_GALAKMECH: // cant grip him, he's in armor case CLASS_ATST: // much too big to grip! - // no droids either + // no droids either case CLASS_PROBE: case CLASS_GONK: case CLASS_R2D2: @@ -1869,8 +1869,8 @@ qboolean ForceTelepathyCheckDirectNPCTarget(gentity_t *self, trace_t *tr, qboole traceEnt->genericValue2 = traceEnt->client->enemyTeam; traceEnt->genericValue3 = traceEnt->s.teamowner; // set the new values - traceEnt->client->playerTeam = (npcteam_t)newPlayerTeam; - traceEnt->client->enemyTeam = (npcteam_t)newEnemyTeam; + traceEnt->client->playerTeam = (npcteam_e)newPlayerTeam; + traceEnt->client->enemyTeam = (npcteam_e)newEnemyTeam; traceEnt->s.teamowner = newPlayerTeam; // FIXME: need a *charmed* timer on this...? Or do TEAM_PLAYERS assume that "confusion" means they should switch to team_enemy when // done? diff --git a/game/w_saber.cpp b/game/w_saber.cpp index b33eb88..e44e5bc 100644 --- a/game/w_saber.cpp +++ b/game/w_saber.cpp @@ -41,7 +41,6 @@ float RandFloat(float min, float max) { return ((randActual * (max - min)) / randMax) + min; } -#ifdef DEBUG_SABER_BOX void G_DebugBoxLines(vector3 *mins, vector3 *maxs, int duration) { vector3 start; vector3 end; @@ -74,7 +73,6 @@ void G_DebugBoxLines(vector3 *mins, vector3 *maxs, int duration) { G_TestLine(&start, &end, 0x00000ff, duration); G_TestLine(&start, mins, 0x00000ff, duration); } -#endif // general check for performing certain attacks against others qboolean G_CanBeEnemy(gentity_t *self, gentity_t *enemy) { @@ -160,11 +158,9 @@ static int G_SaberAttackPower(gentity_t *ent, qboolean attacking) { } } -#ifdef _DEBUG if (g_saberDebugPrint.integer > 1) { Com_Printf("Client %i: ATT STR: %i\n", ent->s.number, baseLevel); } -#endif } if ((ent->client->ps.brokenLimbs & (1 << BROKENLIMB_RARM)) || @@ -274,7 +270,6 @@ void SaberUpdateSelf(gentity_t *ent) { ent->r.contents = 0; ent->clipmask = 0; } else { // Standard contents (saber is active) -#ifdef DEBUG_SABER_BOX if (g_saberDebugBox.integer == 1 || g_saberDebugBox.integer == 4) { vector3 dbgMins; vector3 dbgMaxs; @@ -284,7 +279,6 @@ void SaberUpdateSelf(gentity_t *ent) { G_DebugBoxLines(&dbgMins, &dbgMaxs, (10.0f / sv_fps.value) * 100); } -#endif if (ent->r.contents != CONTENTS_LIGHTSABER) { if ((level.time - g_entities[ent->r.ownerNum].client->lastSaberStorageTime) <= 200) { // Only go back to solid once we're sure our owner has updated recently @@ -370,11 +364,9 @@ static void SetSaberBoxSize(gentity_t *saberent) { if (!forceBlock) { // no sabers/blades to FORCE to be on, so turn off blocking altogether VectorClear(&saberent->r.mins); VectorClear(&saberent->r.maxs); -#ifdef _DEBUG if (g_saberDebugPrint.integer > 1) { Com_Printf("Client %i in broken parry, saber box 0\n", owner->s.number); } -#endif return; } } @@ -884,7 +876,7 @@ static qboolean SaberAttacking(gentity_t *self) { return qfalse; } -typedef enum { LOCK_FIRST = 0, LOCK_TOP = LOCK_FIRST, LOCK_DIAG_TR, LOCK_DIAG_TL, LOCK_DIAG_BR, LOCK_DIAG_BL, LOCK_R, LOCK_L, LOCK_RANDOM } sabersLockMode_t; +enum sabersLockMode_e { LOCK_FIRST = 0, LOCK_TOP = LOCK_FIRST, LOCK_DIAG_TR, LOCK_DIAG_TL, LOCK_DIAG_BR, LOCK_DIAG_BL, LOCK_R, LOCK_L, LOCK_RANDOM }; #define LOCK_IDEAL_DIST_TOP 32.0f #define LOCK_IDEAL_DIST_CIRCLE 48.0f @@ -988,7 +980,7 @@ int G_SaberLockAnim(int attackerSaberStyle, int defenderSaberStyle, int topOrSid qboolean BG_CheckIncrementLockAnim(int anim, int winOrLose); // bg_saber.c #define LOCK_IDEAL_DIST_JKA 46.0f // all of the new saberlocks are 46.08f from each other because Richard Lico is da MAN -static qboolean WP_SabersCheckLock2(gentity_t *attacker, gentity_t *defender, sabersLockMode_t lockMode) { +static qboolean WP_SabersCheckLock2(gentity_t *attacker, gentity_t *defender, sabersLockMode_e lockMode) { int attAnim, defAnim = 0; float attStart = 0.5f, defStart = 0.5f; float idealDist = 48.0f; @@ -1000,7 +992,7 @@ static qboolean WP_SabersCheckLock2(gentity_t *attacker, gentity_t *defender, sa // MATCH ANIMS if (lockMode == LOCK_RANDOM) { - lockMode = (sabersLockMode_t)Q_irand((int)LOCK_FIRST, (int)(LOCK_RANDOM)-1); + lockMode = (sabersLockMode_e)Q_irand((int)LOCK_FIRST, (int)(LOCK_RANDOM)-1); } if (attacker->client->ps.fd.saberAnimLevel >= SS_FAST && attacker->client->ps.fd.saberAnimLevel <= SS_TAVION && defender->client->ps.fd.saberAnimLevel >= SS_FAST && @@ -1565,17 +1557,13 @@ static qboolean WP_GetSaberDeflectionAngle(gentity_t *attacker, gentity_t *defen && (defSaberLevel == attSaberLevel || Q_irand(0, defSaberLevel - attSaberLevel) >= 0)) // and the defender's style is stronger { // bounce straight back -#ifdef _DEBUG int attMove = attacker->client->ps.saberMove; -#endif attacker->client->ps.saberMove = PM_SaberBounceForAttack(attacker->client->ps.saberMove); -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("attack %s vs. parry %s bounced to %s\n", animTable[saberMoveData[attMove].animToUse].name, animTable[saberMoveData[defender->client->ps.saberMove].animToUse].name, animTable[saberMoveData[attacker->client->ps.saberMove].animToUse].name); } -#endif attacker->client->ps.saberBlocked = BLOCKED_ATK_BOUNCE; return qfalse; } else { // attack hit at an angle, figure out what angle it should bounce off att @@ -1604,33 +1592,25 @@ static qboolean WP_GetSaberDeflectionAngle(gentity_t *attacker, gentity_t *defen } } if (newQuad == defQuad) { // bounce straight back -#ifdef _DEBUG int attMove = attacker->client->ps.saberMove; -#endif attacker->client->ps.saberMove = PM_SaberBounceForAttack(attacker->client->ps.saberMove); -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("attack %s vs. parry %s bounced to %s\n", animTable[saberMoveData[attMove].animToUse].name, animTable[saberMoveData[defender->client->ps.saberMove].animToUse].name, animTable[saberMoveData[attacker->client->ps.saberMove].animToUse].name); } -#endif attacker->client->ps.saberBlocked = BLOCKED_ATK_BOUNCE; return qfalse; } // else, pick a deflection else { -#ifdef _DEBUG int attMove = attacker->client->ps.saberMove; -#endif attacker->client->ps.saberMove = PM_SaberDeflectionForQuad(newQuad); -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("attack %s vs. parry %s deflected to %s\n", animTable[saberMoveData[attMove].animToUse].name, animTable[saberMoveData[defender->client->ps.saberMove].animToUse].name, animTable[saberMoveData[attacker->client->ps.saberMove].animToUse].name); } -#endif attacker->client->ps.saberBlocked = BLOCKED_BOUNCE_MOVE; return qtrue; } @@ -2340,7 +2320,6 @@ qboolean WP_SabersIntersect(gentity_t *ent1, int ent1SaberNum, int ent1BladeNum, } } -#ifdef DEBUG_SABER_BOX if (g_saberDebugBox.integer == 2 || g_saberDebugBox.integer == 4) { G_TestLine(&saberBase1, &saberTip1, ent1->client->saber[ent1SaberNum].blade[ent1BladeNum].color, 500); G_TestLine(&saberTip1, &saberTipNext1, ent1->client->saber[ent1SaberNum].blade[ent1BladeNum].color, 500); @@ -2350,7 +2329,6 @@ qboolean WP_SabersIntersect(gentity_t *ent1, int ent1SaberNum, int ent1BladeNum, G_TestLine(&saberTip2, &saberTipNext2, ent2->client->saber[ent2SaberNum].blade[ent2BladeNum].color, 500); G_TestLine(&saberTipNext2, &saberBase2, ent2->client->saber[ent2SaberNum].blade[ent2BladeNum].color, 500); } -#endif if (tri_tri_intersect(&saberBase1, &saberTip1, &saberBaseNext1, &saberBase2, &saberTip2, &saberBaseNext2)) return qtrue; if (tri_tri_intersect(&saberBase1, &saberTip1, &saberBaseNext1, &saberBase2, &saberTip2, &saberTipNext2)) @@ -2372,7 +2350,7 @@ static int G_PowerLevelForSaberAnim(gentity_t *ent, int saberNum, qboolean mySab } else { int anim = ent->client->ps.torsoAnim; int animTimer = ent->client->ps.torsoTimer; - int animTimeElapsed = BG_AnimLength(ent->localAnimIndex, (animNumber_t)anim) - animTimer; + int animTimeElapsed = BG_AnimLength(ent->localAnimIndex, (animNumber_e)anim) - animTimer; saberInfo_t *saber = &ent->client->saber[saberNum]; if (anim >= BOTH_A1_T__B_ && anim <= BOTH_D1_B____) { // FIXME: these two need their own style @@ -2833,7 +2811,7 @@ void WP_SaberDoHit(gentity_t *self, int saberNum, int bladeNum) { victim = &g_entities[victimEntityNum[i]]; if (victim->client) { - class_t npc_class = victim->client->NPC_class; + class_e npc_class = victim->client->NPC_class; if (npc_class == CLASS_SEEKER || npc_class == CLASS_PROBE || npc_class == CLASS_MOUSE || npc_class == CLASS_REMOTE || npc_class == CLASS_GONK || npc_class == CLASS_R2D2 || npc_class == CLASS_R5D2 || npc_class == CLASS_PROTOCOL || npc_class == CLASS_MARK1 || npc_class == CLASS_MARK2 || @@ -3486,11 +3464,9 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, // dmg *= 2; } -#ifdef _DEBUG if (g_saberDebugPrint.integer > 2 && dmg > 1) { Com_Printf("CL %i SABER DMG: %i\n", self->s.number, dmg); } -#endif VectorSubtract(saberEnd, saberStart, &dir); VectorNormalize(&dir); @@ -3831,11 +3807,9 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, self->client->ps.saberMove = BG_BrokenParryForAttack(self->client->ps.saberMove); self->client->ps.saberBlocked = BLOCKED_BOUNCE_MOVE; -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("Client %i sent client %i into a reflected attack with a knockaway\n", otherOwner->s.number, self->s.number); } -#endif didDefense = qtrue; } else if ((selfSaberLevel > FORCE_LEVEL_2 || unblockable) && // if we're doing a special attack, we can send them into a broken parry too (MP only) @@ -3852,11 +3826,9 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, saberCheckKnockdown_BrokenParry(&g_entities[otherOwner->client->ps.saberEntityNum], otherOwner, self); } -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("Client %i sent client %i into a broken parry\n", self->s.number, otherOwner->s.number); } -#endif otherOwner->client->ps.saberMove = BG_BrokenParryForParry(otherOwner->client->ps.saberMove); otherOwner->client->ps.saberBlocked = BLOCKED_PARRY_BROKEN; @@ -3872,11 +3844,9 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, !PM_SaberInDeflect(self->client->ps.saberMove) && !PM_SaberInReflect(self->client->ps.saberMove) && dmg > SABER_NONATTACK_DAMAGE && !didOffense && !unblockable) { // they are in a parry, and we are slamming down on them with a move of equal or greater force than their // defense, so send them into a broken parry.. unless they are already in one. -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("Client %i bounced off of client %i's saber\n", self->s.number, otherOwner->s.number); } -#endif if (!tryDeflectAgain) { if (!WP_GetSaberDeflectionAngle(self, otherOwner, tr.fraction)) { @@ -3901,11 +3871,9 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, defendStr += Q_irand(0, otherOwner->client->saber[1].parryBonus); } -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("Client %i and client %i bounced off of each other's sabers\n", self->s.number, otherOwner->s.number); } -#endif attackBonus = Q_irand(0, self->client->saber[0].breakParryBonus); if (self->client->saber[1].model[0] && !self->client->ps.saberHolstered) { @@ -3980,11 +3948,9 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, saberCheckKnockdown_BrokenParry(&g_entities[otherOwner->client->ps.saberEntityNum], otherOwner, self); } -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("Client %i forced client %i into a broken parry with a stronger attack\n", self->s.number, otherOwner->s.number); } -#endif } else { // They are attacking, so are we, and obviously they have an attack level higher than or equal to ours if (selfSaberLevel == otherSaberLevel) { // equal level, try to bounce off each other's sabers if (!didOffense && !PM_SaberInParry(self->client->ps.saberMove) && !PM_SaberInBrokenParry(self->client->ps.saberMove) && @@ -3998,11 +3964,9 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, !PM_SaberInDeflect(otherOwner->client->ps.saberMove) && !PM_SaberInReflect(otherOwner->client->ps.saberMove) && !unblockable) { otherOwner->client->ps.saberBlocked = BLOCKED_ATK_BOUNCE; } -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("Equal attack level bounce/deflection for clients %i and %i\n", self->s.number, otherOwner->s.number); } -#endif self->client->ps.saberEventFlags |= SEF_DEFLECTED; otherOwner->client->ps.saberEventFlags |= SEF_DEFLECTED; @@ -4017,11 +3981,9 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, saberCheckKnockdown_BrokenParry(&g_entities[self->client->ps.saberEntityNum], self, otherOwner); } -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("Client %i hit client %i's stronger attack, was forced into a broken parry\n", self->s.number, otherOwner->s.number); } -#endif otherOwner->client->ps.saberEventFlags &= ~SEF_BLOCKED; @@ -4038,11 +4000,9 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, otherOwner->client->ps.saberEventFlags &= ~SEF_PARRIED; self->client->ps.saberEventFlags &= ~SEF_BLOCKED; -#ifdef _DEBUG if (g_saberDebugPrint.integer) { Com_Printf("Client %i broke through %i's parry with a special or stronger attack\n", self->s.number, otherOwner->s.number); } -#endif } else if (PM_SaberInParry(G_GetParryForBlock(otherOwner->client->ps.saberBlocked)) && !didOffense && tryDeflectAgain) { // We want to try deflecting again because the other is in the parry and we haven't made any new moves int preMove = otherOwner->client->ps.saberMove; @@ -4251,7 +4211,7 @@ qboolean WP_ForcePowerUsable(gentity_t *self, forcePowers_t forcePower); qboolean InFOV3(vector3 *spot, vector3 *from, vector3 *fromAngles, int hFOV, int vFOV); qboolean Jedi_WaitingAmbush(gentity_t *self); void Jedi_Ambush(gentity_t *self); -evasionType_t Jedi_SaberBlockGo(gentity_t *self, usercmd_t *cmd, vector3 *pHitloc, vector3 *phitDir, gentity_t *incoming, float dist); +evasionType_e Jedi_SaberBlockGo(gentity_t *self, usercmd_t *cmd, vector3 *pHitloc, vector3 *phitDir, gentity_t *incoming, float dist); void NPC_SetLookTarget(gentity_t *self, int entNum, int clearTime); void WP_SaberStartMissileBlockCheck(gentity_t *self, usercmd_t *ucmd) { float dist; @@ -6124,7 +6084,7 @@ static gentity_t *G_KickTrace(gentity_t *ent, vector3 *kickDir, float kickDist, static void G_KickSomeMofos(gentity_t *ent) { vector3 kickDir, kickEnd, fwdAngs; - float animLength = BG_AnimLength(ent->localAnimIndex, (animNumber_t)ent->client->ps.legsAnim); + float animLength = BG_AnimLength(ent->localAnimIndex, (animNumber_e)ent->client->ps.legsAnim); float elapsedTime = (float)(animLength - ent->client->ps.legsTimer); float remainingTime = (animLength - elapsedTime); float kickDist = (ent->r.maxs.x * 1.5f) + STAFF_KICK_RANGE + 8.0f; // fudge factor of 8 diff --git a/game/w_saber.h b/game/w_saber.h index 3af6a55..f3f786f 100644 --- a/game/w_saber.h +++ b/game/w_saber.h @@ -31,9 +31,9 @@ #define FORCE_LIGHTNING_RADIUS 300 #define MAX_DRAIN_DISTANCE 512 -typedef enum forceJump_e { FJ_FORWARD, FJ_BACKWARD, FJ_RIGHT, FJ_LEFT, FJ_UP } forceJump_t; +enum forceJump_e { FJ_FORWARD, FJ_BACKWARD, FJ_RIGHT, FJ_LEFT, FJ_UP }; -typedef enum { +enum evasionType_e { EVASION_NONE = 0, EVASION_PARRY, EVASION_DUCK_PARRY, @@ -45,7 +45,7 @@ typedef enum { EVASION_CARTWHEEL, EVASION_OTHER, NUM_EVASION_TYPES -} evasionType_t; +}; #define SABERMINS_X -3.0f //-24.0f #define SABERMINS_Y -3.0f //-24.0f diff --git a/maxmind/SConscript b/maxmind/SConscript index 960e19d..ebbf3dd 100644 --- a/maxmind/SConscript +++ b/maxmind/SConscript @@ -21,6 +21,9 @@ if "gcc" in env["CC"] or "clang" in env["CC"]: maxmind_env["CFLAGS"] += [ "-std=c99", ] + maxmind_env["CCFLAGS"] += [ + "-Wno-double-promotion", + ] maxmind_env["CPPPATH"] += ["#" + os.sep + "maxmind"] diff --git a/ui/keycodes.h b/ui/keycodes.h index 16ed4c2..5caaecb 100644 --- a/ui/keycodes.h +++ b/ui/keycodes.h @@ -5,7 +5,7 @@ // these are the key numbers that should be passed to KeyEvent -typedef enum { +enum fakeAscii_e { A_NULL = 0, A_SHIFT, A_CTRL, @@ -337,7 +337,7 @@ typedef enum { A_AUX31, MAX_KEYS -} fakeAscii_t; +}; // The menu code needs to get both key and char events, but // to avoid duplicating the paths, the char events are just diff --git a/ui/ui_local.h b/ui/ui_local.h index 3fe83c0..fa1963a 100644 --- a/ui/ui_local.h +++ b/ui/ui_local.h @@ -31,15 +31,7 @@ void UI_ClearScores(void); void UI_LoadArenas(void); void UI_LoadForceConfig_List(void); -typedef enum moveDataTitles_e { - MD_ACROBATICS = 0, - MD_SINGLE_FAST, - MD_SINGLE_MEDIUM, - MD_SINGLE_STRONG, - MD_DUAL_SABERS, - MD_SABER_STAFF, - MD_MOVE_TITLE_MAX -} moveDataTitles_t; +enum moveDataTitles_e { MD_ACROBATICS = 0, MD_SINGLE_FAST, MD_SINGLE_MEDIUM, MD_SINGLE_STRONG, MD_DUAL_SABERS, MD_SABER_STAFF, MD_MOVE_TITLE_MAX }; // // ui_players.c @@ -89,14 +81,14 @@ typedef struct playerInfo_s { // currently in use drawing parms vector3 viewAngles; vector3 moveAngles; - weapon_t currentWeapon; + weapon_e currentWeapon; int legsAnim; int torsoAnim; // animation vars - weapon_t weapon; - weapon_t lastWeapon; - weapon_t pendingWeapon; + weapon_e weapon; + weapon_e lastWeapon; + weapon_e pendingWeapon; int weaponTimer; int pendingLegsAnim; int torsoAnimationTimer; @@ -394,18 +386,11 @@ void JP_SaveFavServers(void); void JP_QueryServer(void); #endif -typedef enum updateStatus_e { - JAPP_UPDATE_UPTODATE = 0, - JAPP_UPDATE_OUTDATED, - JAPP_UPDATE_UPDATED, -} updateStatus_t; - typedef struct uiLocal_s { #ifdef FAV_SERVERS favServer_t servers[MAX_SERVERS]; unsigned int serversCount; #endif - int updateStatus; } uiLocal_t; extern uiLocal_t uiLocal; diff --git a/ui/ui_main.cpp b/ui/ui_main.cpp index 567f71a..623461d 100644 --- a/ui/ui_main.cpp +++ b/ui/ui_main.cpp @@ -41,7 +41,7 @@ const char *forcepowerDesc[NUM_FORCE_POWERS] = { "@SP_INGAME_FORCE_SABER_DEFENSE_DESC", "@SP_INGAME_FORCE_SABER_THROW_DESC"}; // Movedata Sounds -typedef enum moveDataSounds_e { MDS_NONE = 0, MDS_FORCE_JUMP, MDS_ROLL, MDS_SABER, MDS_MOVE_SOUNDS_MAX } moveDataSounds_t; +enum moveDataSounds_e { MDS_NONE = 0, MDS_FORCE_JUMP, MDS_ROLL, MDS_SABER, MDS_MOVE_SOUNDS_MAX }; // Some hard coded badness // At some point maybe this should be externalized to a .dat file @@ -678,7 +678,7 @@ static void UI_BuildPlayerList(void) { } } -void UI_SetActiveMenu(uiMenuCommand_t menu) { +void UI_SetActiveMenu(uiMenuCommand_e menu) { char buf[256]; // this should be the ONLY way the menu system is brought up @@ -2164,7 +2164,7 @@ static void UI_DrawServerRefreshDate(rectDef_t *rect, float scale, const vector4 lowLight.g = 0.8f * color->g; lowLight.b = 0.8f * color->b; lowLight.a = 0.8f * color->a; - LerpColor(color, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(uiInfo.uiDC.realTime / PULSE_DIVISOR))); + LerpColor(color, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(uiInfo.uiDC.realTime / (float)PULSE_DIVISOR))); trap->SE_GetStringTextString("MP_INGAME_GETTINGINFOFORSERVERS", holdSPString, sizeof(holdSPString)); const Font font(iMenuFont, scale, customFont); @@ -3492,20 +3492,20 @@ static void UI_StartSkirmish(qboolean next) { if (ui_gameType.integer == GT_DUEL || ui_gameType.integer == GT_POWERDUEL) { temp = uiInfo.mapList[ui_currentMap.integer].teamMembers * 2; trap->Cvar_Set("sv_maxClients", va("%d", temp)); - Com_sprintf(buff, sizeof(buff), "wait ; addbot %s %f f, %i \n", uiInfo.mapList[ui_currentMap.integer].opponentName, skill, delay); + Com_sprintf(buff, sizeof(buff), "wait ; addbot %s %f f, %i \n", uiInfo.mapList[ui_currentMap.integer].opponentName, (double)skill, delay); trap->Cmd_ExecuteText(EXEC_APPEND, buff); } else if (ui_gameType.integer == GT_HOLOCRON || ui_gameType.integer == GT_JEDIMASTER) { temp = uiInfo.mapList[ui_currentMap.integer].teamMembers * 2; trap->Cvar_Set("sv_maxClients", va("%d", temp)); for (i = 0; i < uiInfo.mapList[ui_currentMap.integer].teamMembers; i++) { - Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), skill, + Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), (double)skill, (ui_gameType.integer == GT_HOLOCRON) ? "f" : "b", delay, uiInfo.teamList[k].teamMembers[i]); trap->Cmd_ExecuteText(EXEC_APPEND, buff); delay += 500; } k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName")); for (i = 0; i < uiInfo.mapList[ui_currentMap.integer].teamMembers - 1; i++) { - Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), skill, + Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), (double)skill, (ui_gameType.integer == GT_HOLOCRON) ? "f" : "r", delay, uiInfo.teamList[k].teamMembers[i]); trap->Cmd_ExecuteText(EXEC_APPEND, buff); delay += 500; @@ -3514,14 +3514,14 @@ static void UI_StartSkirmish(qboolean next) { temp = uiInfo.mapList[ui_currentMap.integer].teamMembers * 2; trap->Cvar_Set("sv_maxClients", va("%d", temp)); for (i = 0; i < uiInfo.mapList[ui_currentMap.integer].teamMembers; i++) { - Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), skill, + Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), (double)skill, (ui_gameType.integer == GT_FFA) ? "f" : "b", delay, uiInfo.teamList[k].teamMembers[i]); trap->Cmd_ExecuteText(EXEC_APPEND, buff); delay += 500; } k = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName")); for (i = 0; i < uiInfo.mapList[ui_currentMap.integer].teamMembers - 1; i++) { - Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), skill, + Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s %i %s\n", UI_AIFromName(uiInfo.teamList[k].teamMembers[i]), (double)skill, (ui_gameType.integer == GT_FFA) ? "f" : "r", delay, uiInfo.teamList[k].teamMembers[i]); trap->Cmd_ExecuteText(EXEC_APPEND, buff); delay += 500; @@ -4482,7 +4482,7 @@ void UI_SiegeSetCvarsForClass(siegeClass_t *scl) { count++; trap->Cvar_Set(va("ui_class_weapondesc%i", count), " "); // Blank it out to start with } else { - const gitem_t *item = BG_FindItemForWeapon((weapon_t)i); + const gitem_t *item = BG_FindItemForWeapon((weapon_e)i); trap->Cvar_Set(va("ui_class_weapon%i", count), item->icon); trap->Cvar_Set(va("ui_class_weapondesc%i", count), item->description); count++; @@ -4499,7 +4499,7 @@ void UI_SiegeSetCvarsForClass(siegeClass_t *scl) { while (i < HI_NUM_HOLDABLE) { if (scl->invenItems & (1 << i)) { - const gitem_t *item = BG_FindItemForHoldable((holdable_t)i); + const gitem_t *item = BG_FindItemForHoldable((holdable_e)i); trap->Cvar_Set(va("ui_class_item%i", count), item->icon); trap->Cvar_Set(va("ui_class_itemdesc%i", count), item->description); count++; @@ -4531,7 +4531,7 @@ void UI_SiegeSetCvarsForClass(siegeClass_t *scl) { // now health and armor trap->Cvar_Set("ui_class_health", va("%i", scl->maxhealth)); trap->Cvar_Set("ui_class_armor", va("%i", scl->maxarmor)); - trap->Cvar_Set("ui_class_speed", va("%3.2f", scl->speed)); + trap->Cvar_Set("ui_class_speed", va("%3.2f", (double)scl->speed)); // now get the icon path based on the shader index if (scl->classShader) { @@ -4678,9 +4678,9 @@ static void UI_RunMenuScript(char **args) { if (numval <= maxcl) { if (ui_netGameType.integer >= GT_TEAM) { - Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s\n", UI_GetBotNameByNumber(bot - 2), skill, "Blue"); + Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s\n", UI_GetBotNameByNumber(bot - 2), (double)skill, "Blue"); } else { - Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f \n", UI_GetBotNameByNumber(bot - 2), skill); + Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f \n", UI_GetBotNameByNumber(bot - 2), (double)skill); } trap->Cmd_ExecuteText(EXEC_APPEND, buff); added++; @@ -4694,9 +4694,9 @@ static void UI_RunMenuScript(char **args) { if (numval <= maxcl) { if (ui_netGameType.integer >= GT_TEAM) { - Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s\n", UI_GetBotNameByNumber(bot - 2), skill, "Red"); + Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f %s\n", UI_GetBotNameByNumber(bot - 2), (double)skill, "Red"); } else { - Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f \n", UI_GetBotNameByNumber(bot - 2), skill); + Com_sprintf(buff, sizeof(buff), "addbot \"%s\" %f \n", UI_GetBotNameByNumber(bot - 2), (double)skill); } trap->Cmd_ExecuteText(EXEC_APPEND, buff); added++; @@ -5603,7 +5603,7 @@ static int UI_HeadCountByColor(void) { for (i = 0; i < uiInfo.q3HeadCount; i++) { Q_strncpyz(saved, uiInfo.q3HeadNames[i], sizeof(saved)); Q_strrev(uiInfo.q3HeadNames[i]); - if (uiInfo.q3HeadNames[i] && + if (uiInfo.q3HeadNames[i][0] && (!Q_stricmpn(uiInfo.q3HeadNames[i], teamname, strlen(teamname)) || (uiSkinColor == TEAM_FREE && Q_stricmpn(uiInfo.q3HeadNames[i], "der", 3) && Q_stricmpn(uiInfo.q3HeadNames[i], "eulb", 4)))) { Q_strrev(uiInfo.q3HeadNames[i]); @@ -5681,7 +5681,6 @@ static void UI_BuildServerDisplayList(int force) { int i, count, clients, maxClients, ping, game, len, passw /*, visible*/; char info[MAX_STRING_CHARS]; // qboolean startRefresh = qtrue; TTimo: unused - static int numinvisible; int lanSource; if (!(force || uiInfo.uiDC.realTime > uiInfo.serverStatus.nextDisplayRefresh)) { @@ -5707,7 +5706,6 @@ static void UI_BuildServerDisplayList(int force) { lanSource = UI_SourceForLAN(); if (force) { - numinvisible = 0; // clear number of displayed servers uiInfo.serverStatus.numDisplayServers = 0; uiInfo.serverStatus.numPlayersOnServers = 0; @@ -5795,7 +5793,6 @@ static void UI_BuildServerDisplayList(int force) { // done with this server if (ping > 0) { trap->LAN_MarkServerVisible(lanSource, i, qfalse); - numinvisible++; } } } @@ -5942,7 +5939,7 @@ static int UI_GetServerStatusInfo(const char *serverAddress, serverStatusInfo_t } static void UI_BuildFindPlayerList(qboolean force) { - static int numFound, numTimeOuts; + static int numFound; int i, j, resend; serverStatusInfo_t info; char name[MAX_NAME_LENGTH + 2]; @@ -5981,7 +5978,6 @@ static void UI_BuildFindPlayerList(qboolean force) { // sizeof(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers-1]), // "searching %d...", uiInfo.pendingServerStatus.num); numFound = 0; - numTimeOuts++; } for (i = 0; i < MAX_SERVERSTATUSREQUESTS; i++) { // if this pending server is valid @@ -6029,7 +6025,7 @@ static void UI_BuildFindPlayerList(qboolean force) { if (!uiInfo.pendingServerStatus.server[i].valid || uiInfo.pendingServerStatus.server[i].startTime < uiInfo.uiDC.realTime - ui_serverStatusTimeOut.integer) { if (uiInfo.pendingServerStatus.server[i].valid) { - numTimeOuts++; + // ... } // reset server status request for this address UI_GetServerStatusInfo(uiInfo.pendingServerStatus.server[i].adrstr, NULL); @@ -6300,7 +6296,7 @@ static const char *UI_SelectedTeamHead(int index, int *actual) { for (i = 0; i < uiInfo.q3HeadCount; i++) { Q_strncpyz(saved, uiInfo.q3HeadNames[i], sizeof(saved)); Q_strrev(uiInfo.q3HeadNames[i]); - if (uiInfo.q3HeadNames[i] && + if (uiInfo.q3HeadNames[i][0] && (!Q_stricmpn(uiInfo.q3HeadNames[i], teamname, strlen(teamname)) || (uiSkinColor == TEAM_FREE && Q_stricmpn(uiInfo.q3HeadNames[i], "der", 3) && Q_stricmpn(uiInfo.q3HeadNames[i], "eulb", 4)))) { Q_strrev(uiInfo.q3HeadNames[i]); @@ -8393,7 +8389,7 @@ Q_CABI { return Menus_AnyFullScreenVisible(); case UI_SET_ACTIVE_MENU: - UI_SetActiveMenu((uiMenuCommand_t)arg0); + UI_SetActiveMenu((uiMenuCommand_e)arg0); return 0; case UI_CONSOLE_COMMAND: diff --git a/ui/ui_public.h b/ui/ui_public.h index af321a3..d444a9c 100644 --- a/ui/ui_public.h +++ b/ui/ui_public.h @@ -15,7 +15,7 @@ typedef struct uiClientState_s { char messageString[MAX_STRING_CHARS]; } uiClientState_t; -typedef enum uiMenuCommand_e { +enum uiMenuCommand_e { UIMENU_NONE, UIMENU_MAIN, UIMENU_INGAME, @@ -28,7 +28,7 @@ typedef enum uiMenuCommand_e { UIMENU_VOICECHAT, UIMENU_CLOSEALL, UIMENU_CLASSSEL -} uiMenuCommand_t; +}; #define SORT_HOST 0 #define SORT_MAP 1 @@ -36,7 +36,7 @@ typedef enum uiMenuCommand_e { #define SORT_GAME 3 #define SORT_PING 4 -typedef enum uiImportLegacy_e { +enum uiImportLegacy_e { UI_ERROR, UI_PRINT, UI_MILLISECONDS, @@ -189,9 +189,9 @@ typedef enum uiImportLegacy_e { UI_G2_GETSURFACENAME, UI_G2_SETSKIN, UI_G2_ATTACHG2MODEL, -} uiImportLegacy_t; +}; -typedef enum uiExportLegacy_e { +enum uiExportLegacy_e { UI_GETAPIVERSION = 0, UI_INIT, UI_SHUTDOWN, @@ -204,7 +204,7 @@ typedef enum uiExportLegacy_e { UI_DRAW_CONNECT_SCREEN, UI_HASUNIQUECDKEY, UI_MENU_RESET -} uiExportLegacy_t; +}; typedef struct uiImport_s { void (*Print)(const char *msg, ...); @@ -496,7 +496,7 @@ typedef struct uiExport_s { qboolean (*IsFullscreen)(void); - void (*SetActiveMenu)(uiMenuCommand_t menu); + void (*SetActiveMenu)(uiMenuCommand_e menu); qboolean (*ConsoleCommand)(int realTime); diff --git a/ui/ui_saber.cpp b/ui/ui_saber.cpp index 61c3287..b1900c6 100644 --- a/ui/ui_saber.cpp +++ b/ui/ui_saber.cpp @@ -5,8 +5,8 @@ void WP_SaberLoadParms(void); qboolean WP_SaberParseParm(const char *saberName, const char *parmname, char *saberData); saber_colors_t TranslateSaberColor(const char *name); const char *SaberColorToString(saber_colors_t color); -saber_styles_t TranslateSaberStyle(const char *name); -saberType_t TranslateSaberType(const char *name); +saber_styles_e TranslateSaberStyle(const char *name); +saberType_e TranslateSaberType(const char *name); qboolean ui_saber_parms_parsed = qfalse; @@ -664,7 +664,7 @@ void UI_DoSFXSaber(vector3 *blade_muz, vector3 *blade_tip, vector3 *trail_tip, v } } -void UI_SaberDrawBlade(itemDef_t *item, char *saberName, int saberModel, saberType_t saberType, vector3 *origin, vector3 *angles, int bladeNum) { +void UI_SaberDrawBlade(itemDef_t *item, char *saberName, int saberModel, saberType_e saberType, vector3 *origin, vector3 *angles, int bladeNum) { vector3 org_, end, axis_[3] = {{0.0f}}; // shut the compiler up mdxaBone_t boltMatrix; effectTrailArgStruct_t fx; @@ -940,7 +940,7 @@ return; } if ( saber[0] ) { -saberType_t saberType; +saberType_e saberType; int curBlade; int numBlades = UI_SaberNumBladesForSaber( saber ); if ( numBlades ) @@ -959,7 +959,7 @@ UI_SaberDrawBlade( item, saber, saberType, origin, angles, curBlade ); void UI_GetSaberForMenu(char *saber, int saberNum) { char saberTypeString[MAX_QPATH] = {0}; - saberType_t saberType = SABER_NONE; + saberType_e saberType = SABER_NONE; if (saberNum == 0) { trap->Cvar_VariableStringBuffer("ui_saber", saber, MAX_QPATH); @@ -1037,7 +1037,7 @@ void UI_SaberDrawBlades(itemDef_t *item, vector3 *origin, vector3 *angles) { return; } if (saber[0]) { - saberType_t saberType; + saberType_e saberType; int curBlade = 0; int numBlades = UI_SaberNumBladesForSaber(saber); if (numBlades) { // okay, here we go, time to draw each blade... diff --git a/ui/ui_shared.cpp b/ui/ui_shared.cpp index e8e1c82..ee8089d 100644 --- a/ui/ui_shared.cpp +++ b/ui/ui_shared.cpp @@ -221,11 +221,11 @@ void String_Report(void) { f = strPoolIndex; f /= STRING_POOL_SIZE; f *= 100; - Com_Printf("String Pool is %.1f%% full, %i bytes out of %i used.\n", f, strPoolIndex, STRING_POOL_SIZE); + Com_Printf("String Pool is %.1f%% full, %i bytes out of %i used.\n", (double)f, strPoolIndex, STRING_POOL_SIZE); f = allocPoint; f /= MEM_POOL_SIZE; f *= 100; - Com_Printf("Memory Pool is %.1f%% full, %i bytes out of %i used.\n", f, allocPoint, MEM_POOL_SIZE); + Com_Printf("Memory Pool is %.1f%% full, %i bytes out of %i used.\n", (double)f, allocPoint, MEM_POOL_SIZE); } void String_Init(void) { @@ -852,9 +852,9 @@ qboolean Script_SetItemRectCvar(itemDef_t *item, char **args) { if (String_Parse(&holdBuf, &holdVal)) { menuDef_t *menu = (menuDef_t *)item->parent; - item2->window.rectClient.x = atof(holdVal) + menu->window.rect.x; + item2->window.rectClient.x = atoff(holdVal) + menu->window.rect.x; if (String_Parse(&holdBuf, &holdVal)) { - item2->window.rectClient.y = atof(holdVal) + menu->window.rect.y; + item2->window.rectClient.y = atoff(holdVal) + menu->window.rect.y; if (String_Parse(&holdBuf, &holdVal)) { item2->window.rectClient.w = atof(holdVal); if (String_Parse(&holdBuf, &holdVal)) { @@ -2954,7 +2954,7 @@ qboolean Item_Multi_HandleKey(itemDef_t *item, int key) { if (((float)((int)value)) == value) { DC->setCVar(item->cvar, va("%i", (int)value)); } else { - DC->setCVar(item->cvar, va("%f", value)); + DC->setCVar(item->cvar, va("%f", (double)value)); } } if (item->special.i) { // its a feeder? @@ -3337,7 +3337,7 @@ static void Scroll_Slider_ThumbFunc(void *p) { value /= sliderWidth; value *= (editDef->maxVal - editDef->minVal); value += editDef->minVal; - DC->setCVar(si->item->cvar, va("%f", value)); + DC->setCVar(si->item->cvar, va("%f", (double)value)); } void Item_StartCapture(itemDef_t *item, int key) { @@ -3448,7 +3448,7 @@ qboolean Item_Slider_HandleKey(itemDef_t *item, int key, qboolean down) { // vm fuckage // value = (((float)(DC->cursorx - x)/ SLIDER_WIDTH) * (editDef->maxVal - editDef->minVal)); value += editDef->minVal; - DC->setCVar(item->cvar, va("%f", value)); + DC->setCVar(item->cvar, va("%f", (double)value)); return qtrue; } } @@ -3910,13 +3910,13 @@ void Item_TextColor(itemDef_t *item, vector4 *newColor) { lowLight.g = 0.8f * parent->focusColor.g; lowLight.b = 0.8f * parent->focusColor.b; lowLight.a = 0.8f * parent->focusColor.a; - LerpColor(&parent->focusColor, &lowLight, newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / PULSE_DIVISOR))); + LerpColor(&parent->focusColor, &lowLight, newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / (float)PULSE_DIVISOR))); } else if (item->textStyle == uiTextStyle_e::Blink && !((DC->realTime / BLINK_DIVISOR) & 1)) { lowLight.r = 0.8f * item->window.foreColor.r; lowLight.g = 0.8f * item->window.foreColor.g; lowLight.b = 0.8f * item->window.foreColor.b; lowLight.a = 0.8f * item->window.foreColor.a; - LerpColor(&item->window.foreColor, &lowLight, newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / PULSE_DIVISOR))); + LerpColor(&item->window.foreColor, &lowLight, newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / (float)PULSE_DIVISOR))); } else { memcpy(newColor, &item->window.foreColor, sizeof(vector4)); // items can be enabled and disabled based on cvars @@ -3998,7 +3998,7 @@ void Item_Text_AutoWrapped_Paint(itemDef_t *item) { } else if (item->textalignment == ITEM_ALIGN_RIGHT) { item->textRect.x = item->textalignx - newLineWidth; } else if (item->textalignment == ITEM_ALIGN_CENTER) { - item->textRect.x = item->textalignx - newLineWidth / 2; + item->textRect.x = item->textalignx - newLineWidth / 2.0f; } item->textRect.y = y; ToWindowCoords(&item->textRect.x, &item->textRect.y, &item->window); @@ -4153,7 +4153,7 @@ void Item_TextField_Paint(itemDef_t *item) { lowLight.g = 0.8f * parent->focusColor.g; lowLight.b = 0.8f * parent->focusColor.b; lowLight.a = 0.8f * parent->focusColor.a; - LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / PULSE_DIVISOR))); + LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / (float)PULSE_DIVISOR))); } else { memcpy(&newColor, &item->window.foreColor, sizeof(vector4)); } @@ -4185,7 +4185,7 @@ void Item_YesNo_Paint(itemDef_t *item) { lowLight.g = 0.8f * parent->focusColor.g; lowLight.b = 0.8f * parent->focusColor.b; lowLight.a = 0.8f * parent->focusColor.a; - LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / PULSE_DIVISOR))); + LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / (float)PULSE_DIVISOR))); } else { memcpy(&newColor, &item->window.foreColor, sizeof(vector4)); } @@ -4218,7 +4218,7 @@ void Item_Multi_Paint(itemDef_t *item) { lowLight.g = 0.8f * parent->focusColor.g; lowLight.b = 0.8f * parent->focusColor.b; lowLight.a = 0.8f * parent->focusColor.a; - LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / PULSE_DIVISOR))); + LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / (float)PULSE_DIVISOR))); } else { memcpy(&newColor, &item->window.foreColor, sizeof(vector4)); } @@ -4460,7 +4460,7 @@ void Item_Slider_Paint(itemDef_t *item) { lowLight.g = 0.8f * parent->focusColor.g; lowLight.b = 0.8f * parent->focusColor.b; lowLight.a = 0.8f * parent->focusColor.a; - LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / PULSE_DIVISOR))); + LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / (float)PULSE_DIVISOR))); } else { memcpy(&newColor, &item->window.foreColor, sizeof(vector4)); } @@ -4523,7 +4523,7 @@ void Item_Bind_Paint(itemDef_t *item) { lowLight.b = 0.8f * parent->focusColor.b; lowLight.a = 0.8f * parent->focusColor.a; } - LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / PULSE_DIVISOR))); + LerpColor(&parent->focusColor, &lowLight, &newColor, 0.5f + 0.5f * sinf((float)(DC->realTime / (float)PULSE_DIVISOR))); } else { memcpy(&newColor, &item->window.foreColor, sizeof(vector4)); } @@ -5279,13 +5279,13 @@ void Item_OwnerDraw_Paint(itemDef_t *item) { lowLight.g = 0.8f * parent->focusColor.g; lowLight.b = 0.8f * parent->focusColor.b; lowLight.a = 0.8f * parent->focusColor.a; - LerpColor(&parent->focusColor, &lowLight, &color, 0.5f + 0.5f * sinf((float)(DC->realTime / PULSE_DIVISOR))); + LerpColor(&parent->focusColor, &lowLight, &color, 0.5f + 0.5f * sinf((float)(DC->realTime / (float)PULSE_DIVISOR))); } else if (item->textStyle == uiTextStyle_e::Blink && !((DC->realTime / BLINK_DIVISOR) & 1)) { lowLight.r = 0.8f * item->window.foreColor.r; lowLight.g = 0.8f * item->window.foreColor.g; lowLight.b = 0.8f * item->window.foreColor.b; lowLight.a = 0.8f * item->window.foreColor.a; - LerpColor(&item->window.foreColor, &lowLight, &color, 0.5f + 0.5f * sinf((float)(DC->realTime / PULSE_DIVISOR))); + LerpColor(&item->window.foreColor, &lowLight, &color, 0.5f + 0.5f * sinf((float)(DC->realTime / (float)PULSE_DIVISOR))); } if (item->disabled) { @@ -6283,7 +6283,7 @@ qboolean ItemParse_asset_model_go(itemDef_t *item, const char *name, int *runTim if (modelPtr->g2skin) { // DC->g2_SetSkin( &item->ghoul2[0], 0, modelPtr->g2skin );//this is going to set the surfs on/off matching - //the skin file trap->G2API_InitGhoul2Model(&item->ghoul2, name, 0, modelPtr->g2skin, 0, 0, 0); ahh, what are you doing?! + // the skin file trap->G2API_InitGhoul2Model(&item->ghoul2, name, 0, modelPtr->g2skin, 0, 0, 0); ahh, what are you doing?! trap->G2API_SetSkin(item->ghoul2, 0, modelPtr->g2skin, modelPtr->g2skin); } } @@ -6712,7 +6712,7 @@ qboolean ItemParse_flag(itemDef_t *item, int handle) { } if (itemFlags[i].string == NULL) { - Com_Printf(va(S_COLOR_YELLOW "Unknown item style value '%s'", token.string)); + Com_Printf( S_COLOR_YELLOW "Unknown item style value '%s'", token.string); } return qtrue; @@ -8330,8 +8330,8 @@ void Menu_PaintAll(void) { if (debugMode) { const Font font(FONT_NONE, 0.75f, false); - font.Paint(5.0f, 25.0f, va("fps: %f", DC->FPS)); - font.Paint(5.0f, 45.0f, va("x: %.0f y:%.0f", DC->cursorx, DC->cursory)); + font.Paint(5.0f, 25.0f, va("fps: %f", (double)DC->FPS)); + font.Paint(5.0f, 45.0f, va("x: %i y:%i", (int)DC->cursorx, (int)DC->cursory)); } }