From 6349216a8af37c452f8d0fedf260447f524400eb Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Sun, 10 Mar 2002 22:13:34 +0000 Subject: [PATCH] no message --- reaction/ta_ui/ta_ui.plg | 8 +- reaction/ta_ui/ui_atoms.c | 15 +- reaction/ta_ui/ui_local.h | 12 +- reaction/ta_ui/ui_main.c | 234 +++++++++++++++++------ reaction/ta_ui/ui_shared.c | 380 +++++++++++++++++++++++++++++++------ reaction/ta_ui/ui_shared.h | 20 +- 6 files changed, 540 insertions(+), 129 deletions(-) diff --git a/reaction/ta_ui/ta_ui.plg b/reaction/ta_ui/ta_ui.plg index 475cf83c..8af02b1f 100644 --- a/reaction/ta_ui/ta_ui.plg +++ b/reaction/ta_ui/ta_ui.plg @@ -6,7 +6,7 @@ --------------------Configuration: ui - Win32 Release TA--------------------

Command Lines

-Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP4A5.tmp" with contents +Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP9A.tmp" with contents [ /nologo /G6 /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /Fp"Release_TA/ta_ui.pch" /YX /Fo"Release_TA/" /Fd"Release_TA/" /FD /c "C:\Games\Quake3\rq3source\reaction\game\bg_misc.c" @@ -20,8 +20,8 @@ Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP4A5.tmp" with conte "C:\Games\Quake3\rq3source\reaction\ta_ui\ui_syscalls.c" "C:\Games\Quake3\rq3source\reaction\ta_ui\ui_util.c" ] -Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP4A5.tmp" -Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP4A6.tmp" with contents +Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP9A.tmp" +Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP9B.tmp" with contents [ /nologo /base:"0x40000000" /dll /incremental:no /pdb:"Release_TA/uix86.pdb" /map:"Release_TA/uix86.map" /machine:I386 /def:".\ui.def" /out:"uix86.dll" /implib:"Release_TA/uix86.lib" .\Release_TA\bg_misc.obj @@ -35,7 +35,7 @@ Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP4A6.tmp" with conte .\Release_TA\ui_syscalls.obj .\Release_TA\ui_util.obj ] -Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP4A6.tmp" +Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP9B.tmp"

Output Window

Compiling... bg_misc.c diff --git a/reaction/ta_ui/ui_atoms.c b/reaction/ta_ui/ui_atoms.c index b499492a..c04d0203 100644 --- a/reaction/ta_ui/ui_atoms.c +++ b/reaction/ta_ui/ui_atoms.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.5 2002/03/10 22:10:10 makro +// no message +// // Revision 1.4 2002/03/03 21:22:58 makro // no message // @@ -411,26 +414,26 @@ qboolean UI_ConsoleCommand( int realTime ) { if ( Q_stricmp (cmd, "inc") == 0 ) { if (trap_Argc() >= 2) { char cvar[MAX_CVAR_VALUE_STRING]; - int amount = 1; + float amount = 1; + float val; int max = 0; - int val; Q_strncpyz(cvar, UI_Argv(1), sizeof(cvar)); - val = (int) trap_Cvar_VariableValue(cvar); + val = trap_Cvar_VariableValue(cvar); if (trap_Argc() >= 3) { - amount = atoi(UI_Argv(2)); + amount = atof(UI_Argv(2)); if (trap_Argc() >= 4) { max = atoi(UI_Argv(3)); } } if (max != 0) { - trap_Cvar_SetValue(cvar, (val+amount) % max); + trap_Cvar_SetValue(cvar, (float) (((int)(val+amount)) % max)); } else { trap_Cvar_SetValue(cvar, val+amount); } } else { - Com_Printf("Usage: inc [amount] [max]\n"); + Com_Printf("Usage: inc [amount] [max]\n"); } return qtrue; } diff --git a/reaction/ta_ui/ui_local.h b/reaction/ta_ui/ui_local.h index 923cca5a..29809ccb 100644 --- a/reaction/ta_ui/ui_local.h +++ b/reaction/ta_ui/ui_local.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.6 2002/03/10 22:10:10 makro +// no message +// // Revision 1.5 2002/03/03 21:22:58 makro // no message // @@ -126,7 +129,7 @@ extern vmCvar_t ui_smallFont; extern vmCvar_t ui_bigFont; extern vmCvar_t ui_serverStatusTimeOut; //Makro - cvar for player model display -extern vmCvar_t ui_RQ3_model_command; +extern vmCvar_t ui_RQ3_modelCommand; // @@ -830,6 +833,10 @@ typedef struct { int currentCrosshair; //Makro - for the SSG crosshair preview int currentSSGCrosshair; + //Makro - save the music volume + float oldMusicVol; + qboolean savedMusicVol; + int startPostGameTime; sfxHandle_t newHighScoreSound; @@ -842,6 +849,9 @@ typedef struct { qboolean inGameLoad; + //Makro - music files currently being played + const char *playingIntro, *playingLoop; + } uiInfo_t; extern uiInfo_t uiInfo; diff --git a/reaction/ta_ui/ui_main.c b/reaction/ta_ui/ui_main.c index f9eac354..bae9e8df 100644 --- a/reaction/ta_ui/ui_main.c +++ b/reaction/ta_ui/ui_main.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.6 2002/03/10 22:10:10 makro +// no message +// // Revision 1.5 2002/03/03 21:22:58 makro // no message // @@ -216,7 +219,7 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a void AssetCache() { - int n; + int n, ssg; //if (Assets.textFont == NULL) { //} //Assets.background = trap_R_RegisterShaderNoMip( ASSET_BACKGROUND ); @@ -244,7 +247,12 @@ void AssetCache() { } //Makro - for the SSG crosshair preview - uiInfo.uiDC.Assets.SSGcrosshairShader = trap_R_RegisterShaderNoMip("gfx/rq3_hud/ssg2x"); + ssg = (int) trap_Cvar_VariableValue("cg_RQ3_ssgCrosshair"); + if (ssg <= 0 || ssg >= NUM_SSGCROSSHAIRS) { + uiInfo.uiDC.Assets.SSGcrosshairShader = trap_R_RegisterShaderNoMip("gfx/rq3_hud/ssg2x"); + } else { + uiInfo.uiDC.Assets.SSGcrosshairShader = trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg2x-%i", ssg)); + } uiInfo.newHighScoreSound = trap_S_RegisterSound("sound/feedback/voc_newhighscore.wav", qfalse); } @@ -264,7 +272,7 @@ void _UI_DrawTopBottom(float x, float y, float w, float h, float size) { } -//Makro - use different animations for the player model depending on ui_RQ3_model_command +//Makro - use different animations for the player model depending on ui_RQ3_modelCommand animNumber_t UI_RQ3_GetAnimForLegs() { @@ -282,7 +290,9 @@ animNumber_t UI_RQ3_GetAnimForLegs() else return LEGS_IDLE; */ - switch (ui_RQ3_model_command.integer) { + int cmd = (int) trap_Cvar_VariableValue("ui_RQ3_modelCommand"); + + switch (cmd) { case 2: return LEGS_BACK; case 3: @@ -300,11 +310,13 @@ animNumber_t UI_RQ3_GetAnimForLegs() } } -//Makro - use different animations for the player model depending on ui_RQ3_model_command +//Makro - use different animations for the player model depending on ui_RQ3_modelCommand animNumber_t UI_RQ3_GetAnimForTorso() { - switch (ui_RQ3_model_command.integer) { + int cmd = (int) trap_Cvar_VariableValue("ui_RQ3_modelCommand"); + + switch (cmd) { case 101: return TORSO_RAISE; case 102: @@ -332,7 +344,9 @@ animNumber_t UI_RQ3_GetAnimForTorso() weapon_t UI_RQ3_GetWeaponForPlayer() { - switch (ui_RQ3_model_command.integer) { + int cmd = (int) trap_Cvar_VariableValue("ui_RQ3_modelCommand"); + + switch (cmd) { case 102: return WP_M3; case 103: @@ -1412,7 +1426,7 @@ static void UI_DrawPlayerModel(rectDef_t *rect) { } } - updateModel = updateModel || (ui_RQ3_model_command.integer != 0); + //updateModel = updateModel || (trap_Cvar_VariableValue("ui_RQ3_modelCommand") != 0); if (updateModel) { memset( &info, 0, sizeof(playerInfo_t) ); viewangles[YAW] = 180 + 40; @@ -1424,10 +1438,18 @@ static void UI_DrawPlayerModel(rectDef_t *rect) { //Makro: Changed from WP_PISTOL to custom function UI_PlayerInfo_SetInfo( &info, UI_RQ3_GetAnimForLegs(), UI_RQ3_GetAnimForTorso(), viewangles, vec3_origin, UI_RQ3_GetWeaponForPlayer(), qfalse ); // UI_RegisterClientModelname( &info, model, head, team); - trap_Cvar_SetValue( "ui_RQ3_model_command", 0); updateModel = qfalse; } + if (trap_Cvar_VariableValue("ui_RQ3_modelCommand") != 0) { + //memset( &info, 0, sizeof(playerInfo_t) ); + viewangles[YAW] = 180 + 40; + viewangles[PITCH] = 0; + viewangles[ROLL] = 0; + UI_PlayerInfo_SetInfo( &info, UI_RQ3_GetAnimForLegs(), UI_RQ3_GetAnimForTorso(), viewangles, vec3_origin, UI_RQ3_GetWeaponForPlayer(), qfalse ); + trap_Cvar_SetValue( "ui_RQ3_modelCommand", 0); + } + UI_DrawPlayer( rect->x, rect->y, rect->w, rect->h, &info, uiInfo.uiDC.realTime / 2); } @@ -1607,7 +1629,7 @@ static void UI_DrawOpponent(rectDef_t *rect) { vec3_t viewangles; vec3_t moveangles; - updateOpponentModel = updateOpponentModel || (ui_RQ3_model_command.integer !=0); + updateOpponentModel = updateOpponentModel || trap_Cvar_VariableValue("ui_RQ3_modelCommand") != 0; if (updateOpponentModel) { strcpy(model, UI_Cvar_VariableString("ui_opponentModel")); @@ -1624,7 +1646,7 @@ static void UI_DrawOpponent(rectDef_t *rect) { UI_PlayerInfo_SetInfo( &info2, UI_RQ3_GetAnimForLegs(), UI_RQ3_GetAnimForTorso(), viewangles, vec3_origin, UI_RQ3_GetWeaponForPlayer(), qfalse ); UI_RegisterClientModelname( &info2, model, headmodel, team); updateOpponentModel = qfalse; - trap_Cvar_SetValue( "ui_RQ3_model_command", 0); + trap_Cvar_SetValue( "ui_RQ3_modelCommand", 0); } UI_DrawPlayer( rect->x, rect->y, rect->w, rect->h, &info2, uiInfo.uiDC.realTime / 2); @@ -1899,15 +1921,20 @@ static void UI_DrawBotSkill(rectDef_t *rect, float scale, vec4_t color, int text } static void UI_DrawRedBlue(rectDef_t *rect, float scale, vec4_t color, int textStyle) { - Text_Paint(rect->x, rect->y, scale, color, (uiInfo.redBlue == 0) ? "Red" : "Blue", 0, 0, textStyle); + //Makro - added Team 1/2 + Text_Paint(rect->x, rect->y, scale, color, (uiInfo.redBlue == 0) ? "1 (Red)" : "2 (Blue)", 0, 0, textStyle); } static void UI_DrawCrosshair(rectDef_t *rect, float scale, vec4_t color) { trap_R_SetColor( color ); + if (uiInfo.currentCrosshair < 0 || uiInfo.currentCrosshair >= NUM_CROSSHAIRS) { uiInfo.currentCrosshair = 0; } - UI_DrawHandlePic( rect->x, rect->y - rect->h, rect->w, rect->h, uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]); + //Makro - fixing bug that draws a crosshair even if cg_drawcrosshair is 0 + if (uiInfo.currentCrosshair != 0) { + UI_DrawHandlePic( rect->x, rect->y - rect->h, rect->w, rect->h, uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]); + } trap_R_SetColor( NULL ); } @@ -2426,9 +2453,10 @@ static qboolean UI_Handicap_HandleKey(int flags, float *special, int key) { } static qboolean UI_Effects_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { uiInfo.effectsColor--; } else { uiInfo.effectsColor++; @@ -2447,14 +2475,15 @@ static qboolean UI_Effects_HandleKey(int flags, float *special, int key) { } static qboolean UI_ClanName_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { int i; i = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName")); if (uiInfo.teamList[i].cinematic >= 0) { trap_CIN_StopCinematic(uiInfo.teamList[i].cinematic); uiInfo.teamList[i].cinematic = -1; } - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { i--; } else { i++; @@ -2474,11 +2503,12 @@ static qboolean UI_ClanName_HandleKey(int flags, float *special, int key) { } static qboolean UI_GameType_HandleKey(int flags, float *special, int key, qboolean resetMap) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { int oldCount = UI_MapCountByGameType(qtrue); // hard coded mess here - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { ui_gameType.integer--; if (ui_gameType.integer == 2) { ui_gameType.integer = 1; @@ -2513,9 +2543,10 @@ static qboolean UI_GameType_HandleKey(int flags, float *special, int key, qboole } static qboolean UI_NetGameType_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { ui_netGameType.integer--; } else { ui_netGameType.integer++; @@ -2538,9 +2569,10 @@ static qboolean UI_NetGameType_HandleKey(int flags, float *special, int key) { } static qboolean UI_JoinGameType_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { ui_joinGameType.integer--; } else { ui_joinGameType.integer++; @@ -2562,13 +2594,24 @@ static qboolean UI_JoinGameType_HandleKey(int flags, float *special, int key) { static qboolean UI_Skill_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW || key == K_HOME || key == K_END) { int i = trap_Cvar_VariableValue( "g_spSkill" ); - if (key == K_MOUSE2) { - i--; - } else { - i++; + switch (key) { + case K_HOME: + i = 1; + break; + case K_END: + i = numSkillLevels; + break; + case K_MOUSE2: + case K_LEFTARROW: + i--; + break; + default: + i++; + break; } if (i < 1) { @@ -2584,11 +2627,12 @@ static qboolean UI_Skill_HandleKey(int flags, float *special, int key) { } static qboolean UI_TeamName_HandleKey(int flags, float *special, int key, qboolean blue) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { int i; i = UI_TeamIndexFromName(UI_Cvar_VariableString((blue) ? "ui_blueTeam" : "ui_redTeam")); - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { i--; } else { i++; @@ -2608,17 +2652,28 @@ static qboolean UI_TeamName_HandleKey(int flags, float *special, int key, qboole } static qboolean UI_TeamMember_HandleKey(int flags, float *special, int key, qboolean blue, int num) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW || key == K_HOME || key == K_END) { // 0 - None // 1 - Human // 2..NumCharacters - Bot char *cvar = va(blue ? "ui_blueteam%i" : "ui_redteam%i", num); int value = trap_Cvar_VariableValue(cvar); - if (key == K_MOUSE2) { - value--; - } else { - value++; + switch (key) { + case K_HOME: + value = 0; + break; + case K_END: + value = UI_GetNumBots() + 2 - 1; + break; + case K_MOUSE2: + case K_LEFTARROW: + value--; + break; + default: + value++; + break; } //Makro - using bot list instead of character list @@ -2645,9 +2700,10 @@ static qboolean UI_TeamMember_HandleKey(int flags, float *special, int key, qboo } static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { ui_netSource.integer--; } else { ui_netSource.integer++; @@ -2670,9 +2726,10 @@ static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) { } static qboolean UI_NetFilter_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { ui_serverFilterType.integer--; } else { ui_serverFilterType.integer++; @@ -2690,8 +2747,9 @@ static qboolean UI_NetFilter_HandleKey(int flags, float *special, int key) { } static qboolean UI_OpponentName_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { - if (key == K_MOUSE2) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { UI_PriorOpponent(); } else { UI_NextOpponent(); @@ -2702,11 +2760,12 @@ static qboolean UI_OpponentName_HandleKey(int flags, float *special, int key) { } static qboolean UI_BotName_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { int game = trap_Cvar_VariableValue("g_gametype"); int value = uiInfo.botIndex; - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { value--; } else { value++; @@ -2735,12 +2794,25 @@ static qboolean UI_BotName_HandleKey(int flags, float *special, int key) { } static qboolean UI_BotSkill_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { - if (key == K_MOUSE2) { - uiInfo.skillIndex--; - } else { - uiInfo.skillIndex++; + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW || key == K_HOME || key == K_END) { + + switch (key) { + case K_HOME: + uiInfo.skillIndex = 0; + break; + case K_END: + uiInfo.skillIndex = numSkillLevels-1; + break; + case K_MOUSE2: + case K_LEFTARROW: + uiInfo.skillIndex--; + break; + default: + uiInfo.skillIndex++; + break; } + if (uiInfo.skillIndex >= numSkillLevels) { uiInfo.skillIndex = 0; } else if (uiInfo.skillIndex < 0) { @@ -2752,7 +2824,8 @@ static qboolean UI_BotSkill_HandleKey(int flags, float *special, int key) { } static qboolean UI_RedBlue_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { uiInfo.redBlue ^= 1; return qtrue; } @@ -2760,8 +2833,9 @@ static qboolean UI_RedBlue_HandleKey(int flags, float *special, int key) { } static qboolean UI_Crosshair_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { - if (key == K_MOUSE2) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { uiInfo.currentCrosshair--; } else { uiInfo.currentCrosshair++; @@ -2772,7 +2846,9 @@ static qboolean UI_Crosshair_HandleKey(int flags, float *special, int key) { } else if (uiInfo.currentCrosshair < 0) { uiInfo.currentCrosshair = NUM_CROSSHAIRS - 1; } - trap_Cvar_Set("cg_drawCrosshair", va("%d", uiInfo.currentCrosshair)); + + trap_Cvar_Set("cg_drawCrosshair", va("%d", uiInfo.currentCrosshair)); + return qtrue; } return qfalse; @@ -2802,7 +2878,8 @@ static qboolean UI_SSG_Crosshair_HandleKey(int flags, float *special, int key) { static qboolean UI_SelectedPlayer_HandleKey(int flags, float *special, int key) { - if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER) { + //Makro - left/right support + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { int selected; UI_BuildPlayerList(); @@ -2811,7 +2888,7 @@ static qboolean UI_SelectedPlayer_HandleKey(int flags, float *special, int key) } selected = trap_Cvar_VariableValue("cg_selectedPlayer"); - if (key == K_MOUSE2) { + if (key == K_MOUSE2 || key == K_LEFTARROW) { selected--; } else { selected++; @@ -3533,8 +3610,13 @@ static void UI_RunMenuScript(char **args) { trap_Cmd_ExecuteText( EXEC_APPEND, va( "connect %s\n", uiInfo.foundPlayerServerAddresses[uiInfo.currentFoundPlayerServer] ) ); } } else if (Q_stricmp(name, "Quit") == 0) { + //Makro - see if we have to restore the music volume + if (uiInfo.savedMusicVol) { + trap_Cmd_ExecuteText( EXEC_NOW, va("set s_musicvolume %f\n", uiInfo.oldMusicVol)); + } trap_Cvar_Set("ui_singlePlayerActive", "0"); - trap_Cmd_ExecuteText( EXEC_NOW, "quit"); + //trap_Cmd_ExecuteText( EXEC_NOW, "quit"); + trap_Cmd_ExecuteText( EXEC_APPEND, "quit\n"); } else if (Q_stricmp(name, "Controls") == 0) { trap_Cvar_Set( "cl_paused", "1" ); trap_Key_SetCatcher( KEYCATCH_UI ); @@ -3701,6 +3783,13 @@ static void UI_RunMenuScript(char **args) { } } else if (Q_stricmp(name, "glCustom") == 0) { trap_Cvar_Set("ui_glCustom", "4"); + //Makro - save/load the music volume + } else if (Q_stricmp(name, "backupMusicVolume") == 0) { + uiInfo.oldMusicVol = trap_Cvar_VariableValue("s_musicvolume"); + uiInfo.savedMusicVol = qtrue; + } else if (Q_stricmp(name, "restoreMusicVolume") == 0) { + trap_Cvar_SetValue("s_musicvolume", uiInfo.oldMusicVol); + uiInfo.savedMusicVol = qfalse; } else if (Q_stricmp(name, "update") == 0) { if (String_Parse(args, &name2)) { UI_Update(name2); @@ -5208,6 +5297,22 @@ static void UI_BuildQ3Model_List( void ) } +//Makro - custom functions to start/stop background music + +void UI_RQ3_StopBackgroundTrack( void ) { + trap_S_StopBackgroundTrack(); + uiInfo.playingIntro = ""; + uiInfo.playingLoop = ""; +} + +void UI_RQ3_StartBackgroundTrack( const char *intro, const char *loop) { + if (uiInfo.playingIntro != intro || uiInfo.playingLoop != loop) { + uiInfo.playingIntro = intro; + uiInfo.playingLoop = loop; + trap_S_StartBackgroundTrack(intro, loop); + } +} + /* ================= @@ -5284,8 +5389,11 @@ void _UI_Init( qboolean inGameLoad ) { uiInfo.uiDC.Pause = &UI_Pause; uiInfo.uiDC.ownerDrawWidth = &UI_OwnerDrawWidth; uiInfo.uiDC.registerSound = &trap_S_RegisterSound; - uiInfo.uiDC.startBackgroundTrack = &trap_S_StartBackgroundTrack; - uiInfo.uiDC.stopBackgroundTrack = &trap_S_StopBackgroundTrack; + //Makro - custom functions + //uiInfo.uiDC.startBackgroundTrack = &trap_S_StartBackgroundTrack; + //uiInfo.uiDC.stopBackgroundTrack = &trap_S_StopBackgroundTrack; + uiInfo.uiDC.startBackgroundTrack = &UI_RQ3_StartBackgroundTrack; + uiInfo.uiDC.stopBackgroundTrack = &UI_RQ3_StopBackgroundTrack; uiInfo.uiDC.playCinematic = &UI_PlayCinematic; uiInfo.uiDC.stopCinematic = &UI_StopCinematic; uiInfo.uiDC.drawCinematic = &UI_DrawCinematic; @@ -5345,6 +5453,14 @@ void _UI_Init( qboolean inGameLoad ) { uiInfo.currentSSGCrosshair = (int)trap_Cvar_VariableValue("cg_RQ3_ssgCrosshair"); trap_Cvar_Set("ui_mousePitch", (trap_Cvar_VariableValue("m_pitch") >= 0) ? "0" : "1"); + //Makro - save the music volume + uiInfo.oldMusicVol = trap_Cvar_VariableValue("s_musicvolume"); + uiInfo.savedMusicVol = qfalse; + + //Makro - music files being played + uiInfo.playingIntro = ""; + uiInfo.playingLoop = ""; + uiInfo.serverStatus.currentServerCinematic = -1; uiInfo.previewMovie = -1; @@ -5852,7 +5968,7 @@ vmCvar_t ui_realCaptureLimit; vmCvar_t ui_realWarmUp; vmCvar_t ui_serverStatusTimeOut; //Makro - cvar for player model display -vmCvar_t ui_RQ3_model_command; +vmCvar_t ui_RQ3_modelCommand; //Makro - for the SSG crosshair preview vmCvar_t ui_RQ3_ssgCrosshair; //Makro - activate the weapon menu after a team join @@ -5981,7 +6097,7 @@ static cvarTable_t cvarTable[] = { { &ui_realCaptureLimit, "capturelimit", "8", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART}, { &ui_serverStatusTimeOut, "ui_serverStatusTimeOut", "7000", CVAR_ARCHIVE}, //Makro - cvar for player model display - { &ui_RQ3_model_command, "ui_RQ3_model_command", "0", CVAR_ARCHIVE}, + { &ui_RQ3_modelCommand, "ui_RQ3_modelCommand", "0", CVAR_ARCHIVE}, { &ui_RQ3_ssgCrosshair, "ui_RQ3_ssgCrosshair", "0", 0}, { &ui_RQ3_weapAfterJoin, "ui_RQ3_weapAfterJoin", "0", CVAR_ARCHIVE} diff --git a/reaction/ta_ui/ui_shared.c b/reaction/ta_ui/ui_shared.c index f1932f63..f9bb952a 100644 --- a/reaction/ta_ui/ui_shared.c +++ b/reaction/ta_ui/ui_shared.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.8 2002/03/10 22:10:10 makro +// no message +// // Revision 1.7 2002/03/03 21:22:58 makro // no message // @@ -848,6 +851,11 @@ void Menu_PostParse(menuDef_t *menu) { menu->window.rect.h = 480; } + //Makro - timer is disabled by default + menu->timerEnabled = qfalse; + menu->nextTimer = 0; + menu->timerPos = 0; + Menu_UpdatePosition(menu); } @@ -1223,8 +1231,6 @@ void Script_Orbit(itemDef_t *item, char **args) { } } - - void Script_SetFocus(itemDef_t *item, char **args) { const char *name; itemDef_t *focusItem; @@ -1288,9 +1294,37 @@ void Script_playLooped(itemDef_t *item, char **args) { } } +//Makro - timer scripts +void Script_StartTimer(itemDef_t *item, char **args) { + menuDef_t *menu = (menuDef_t*) item->parent; + + if (menu) { + if (menu->timedItems > 0) { + menu->timerEnabled = qtrue; + menu->timerPos = 0; + if (menu->timerInterval <= 0) { + menu->timerInterval = 1000; + } + } + } +} + +void Script_StopTimer(itemDef_t *item, char **args) { + menuDef_t *menu = (menuDef_t*) item->parent; + + if (menu) { + menu->timerEnabled = qfalse; + menu->timerPos = 0; + } +} commandDef_t commandList[] = { + //Makro - for timers + {"startTimer", &Script_StartTimer}, // group/name + {"restartTimer", &Script_StartTimer}, // group/name + {"stopTimer", &Script_StopTimer}, // group/name + {"fadein", &Script_FadeIn}, // group/name {"fadeout", &Script_FadeOut}, // group/name {"show", &Script_Show}, // group/name @@ -1982,15 +2016,27 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea qboolean Item_YesNo_HandleKey(itemDef_t *item, int key) { - if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS && item->cvar) { - if (key == K_MOUSE1 || key == K_ENTER || key == K_MOUSE2 || key == K_MOUSE3) { - DC->setCVar(item->cvar, va("%i", !DC->getCVarValue(item->cvar))); - return qtrue; + qboolean ok = qfalse; + + //Makro - an item should react on key presses even if the mouse isn't over it + if (item->window.flags & WINDOW_HASFOCUS && item->cvar) { + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3) { + if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) { + ok = qtrue; + } + } else { + if (key == K_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { + ok = qtrue; + } } - } + } - return qfalse; + if (ok) { + DC->setCVar(item->cvar, va("%i", !DC->getCVarValue(item->cvar))); + return qtrue; + } + return qfalse; } int Item_Multi_CountSettings(itemDef_t *item) { @@ -2055,30 +2101,55 @@ const char *Item_Multi_Setting(itemDef_t *item) { qboolean Item_Multi_HandleKey(itemDef_t *item, int key) { multiDef_t *multiPtr = (multiDef_t*)item->typeData; + + //Makro - added support for left/right keys + //made it so that the mouse pointer doesn't have to be over the item + qboolean ok = qfalse; if (multiPtr) { - if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS && item->cvar) { - if (key == K_MOUSE1 || key == K_ENTER || key == K_MOUSE2 || key == K_MOUSE3) { - int current = Item_Multi_FindCvarByValue(item) + 1; - int max = Item_Multi_CountSettings(item); - if ( current < 0 || current >= max ) { - current = 0; + if (item->window.flags & WINDOW_HASFOCUS && item->cvar) { + if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3) { + if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) { + ok = qtrue; } - if (multiPtr->strDef) { - DC->setCVar(item->cvar, multiPtr->cvarStr[current]); - } else { - float value = multiPtr->cvarValue[current]; - if (((float)((int) value)) == value) { - DC->setCVar(item->cvar, va("%i", (int) value )); - } - else { - DC->setCVar(item->cvar, va("%f", value )); - } + } else { + if (key == K_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { + ok = qtrue; } - return qtrue; } } } - return qfalse; + + if (ok) { + int current = Item_Multi_FindCvarByValue(item) + 1; + int max = Item_Multi_CountSettings(item); + + if (key == K_LEFTARROW) { + current -= 2; + } + + if ( current < 0 ) { + current = max-1; + } else { + if (current >= max) { + current = 0; + } + } + + if (multiPtr->strDef) { + DC->setCVar(item->cvar, multiPtr->cvarStr[current]); + } else { + float value = multiPtr->cvarValue[current]; + if (((float)((int) value)) == value) { + DC->setCVar(item->cvar, va("%i", (int) value )); + } else { + DC->setCVar(item->cvar, va("%f", value )); + } + } + + return qtrue; + } + + return qfalse; } qboolean Item_TextField_HandleKey(itemDef_t *item, int key) { @@ -2384,39 +2455,109 @@ qboolean Item_Slider_HandleKey(itemDef_t *item, int key, qboolean down) { float x, value, width, work; //DC->Print("slider handle key\n"); - if (item->window.flags & WINDOW_HASFOCUS && item->cvar && Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) { + if (item->window.flags & WINDOW_HASFOCUS && item->cvar) { if (key == K_MOUSE1 || key == K_ENTER || key == K_MOUSE2 || key == K_MOUSE3) { + if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) { + editFieldDef_t *editDef = item->typeData; + if (editDef) { + rectDef_t testRect; + width = SLIDER_WIDTH; + if (item->text) { + x = item->textRect.x + item->textRect.w + 8; + } else { + x = item->window.rect.x; + } + + testRect = item->window.rect; + testRect.x = x; + value = (float)SLIDER_THUMB_WIDTH / 2; + testRect.x -= value; + //DC->Print("slider x: %f\n", testRect.x); + testRect.w = (SLIDER_WIDTH + (float)SLIDER_THUMB_WIDTH / 2); + //DC->Print("slider w: %f\n", testRect.w); + if (Rect_ContainsPoint(&testRect, DC->cursorx, DC->cursory)) { + work = DC->cursorx - x; + value = work / width; + value *= (editDef->maxVal - editDef->minVal); + // vm fuckage + // value = (((float)(DC->cursorx - x)/ SLIDER_WIDTH) * (editDef->maxVal - editDef->minVal)); + value += editDef->minVal; + DC->setCVar(item->cvar, va("%f", value)); + return qtrue; + } + } + } + //Makro - adding left/right key handling + } else if (key == K_LEFTARROW || key == K_RIGHTARROW || key == K_HOME || key == K_END) { editFieldDef_t *editDef = item->typeData; + if (editDef) { - rectDef_t testRect; - width = SLIDER_WIDTH; - if (item->text) { - x = item->textRect.x + item->textRect.w + 8; - } else { - x = item->window.rect.x; + value = DC->getCVarValue(item->cvar); + work = (editDef->maxVal - editDef->minVal) / 10; + + switch (key) { + case K_RIGHTARROW: + value = Com_Clamp(editDef->minVal, editDef->maxVal, value+work); + break; + case K_LEFTARROW: + value = Com_Clamp(editDef->minVal, editDef->maxVal, value-work); + break; + case K_HOME: + value = editDef->minVal; + break; + case K_END: + value = editDef->maxVal; + break; + } + + DC->setCVar(item->cvar, va("%f", value)); + return qtrue; + } + //DC->Print("slider LEFT/RIGHT\n"); + } + } + //DC->Print("slider handle key exit\n"); + return qfalse; +} + +//Makro - left/right support for inactive numeric fields +qboolean Item_InActiveTextField_HandleKey(itemDef_t *item, int key) { + if (!g_editingField) { + if (item->type == ITEM_TYPE_NUMERICFIELD && item->cvar) { + if (key == K_LEFTARROW || key == K_RIGHTARROW || key == K_HOME || key == K_PGUP || key == K_PGDN) { + editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData; + int current = (int) DC->getCVarValue(item->cvar); + + switch (key) { + case K_LEFTARROW: + current--; + break; + case K_RIGHTARROW: + current++; + break; + case K_PGUP: + current+=5; + break; + case K_PGDN: + current-=5; + break; + default: + current = 0; + break; } - testRect = item->window.rect; - testRect.x = x; - value = (float)SLIDER_THUMB_WIDTH / 2; - testRect.x -= value; - //DC->Print("slider x: %f\n", testRect.x); - testRect.w = (SLIDER_WIDTH + (float)SLIDER_THUMB_WIDTH / 2); - //DC->Print("slider w: %f\n", testRect.w); - if (Rect_ContainsPoint(&testRect, DC->cursorx, DC->cursory)) { - work = DC->cursorx - x; - value = work / width; - value *= (editDef->maxVal - editDef->minVal); - // vm fuckage - // value = (((float)(DC->cursorx - x)/ SLIDER_WIDTH) * (editDef->maxVal - editDef->minVal)); - value += editDef->minVal; - DC->setCVar(item->cvar, va("%f", value)); - return qtrue; + if (current < 0) { + current = 0; } + if (strlen(va("%i", current)) <= editPtr->maxChars) { + DC->setCVar(item->cvar, va("%i", current)); + } + + return qtrue; } } } - DC->Print("slider handle key exit\n"); + return qfalse; } @@ -2450,9 +2591,16 @@ qboolean Item_HandleKey(itemDef_t *item, int key, qboolean down) { return qfalse; break; case ITEM_TYPE_EDITFIELD: + //Makro - separated editing fields from numeric fields + return qfalse; + break; case ITEM_TYPE_NUMERICFIELD: - //return Item_TextField_HandleKey(item, key); + /* + //return Item_TextField_HandleKey(item, key); return qfalse; + */ + //Makro - left/right support + return Item_InActiveTextField_HandleKey(item, key); break; case ITEM_TYPE_COMBO: return qfalse; @@ -2585,7 +2733,13 @@ void Menus_Activate(menuDef_t *menu) { if (menu->soundName && *menu->soundName) { // DC->stopBackgroundTrack(); // you don't want to do this since it will reset s_rawend - DC->startBackgroundTrack(menu->soundName, menu->soundName); + //Makro - check for intro + if (menu->soundIntro && *menu->soundIntro) { + DC->startBackgroundTrack(menu->soundIntro, menu->soundName); + } else { + DC->startBackgroundTrack(menu->soundName, menu->soundName); + } + } Display_CloseCinematics(); @@ -2646,7 +2800,7 @@ static rectDef_t *Item_CorrectedTextRect(itemDef_t *item) { } //Makro - function to determine whether or not an item is visible -qboolean UI_RQ3_ActiveItem(itemDef_t *item) { +qboolean UI_RQ3_IsActiveItem(itemDef_t *item) { if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) { return qfalse; @@ -2669,7 +2823,7 @@ qboolean UI_RQ3_TriggerShortcut(menuDef_t *menu, int key) { if (DC->realTime >= UI_RQ3_lastCheckForShortcuts+UI_RQ3_ShortcutCheckDelay ) { for (i = 0; i < menu->itemCount; i++) { - if ( menu->items[i]->window.shortcutKey == key && UI_RQ3_ActiveItem(menu->items[i]) ) { + if ( menu->items[i]->window.shortcutKey == key && UI_RQ3_IsActiveItem(menu->items[i]) ) { Item_Action(menu->items[i]); return qtrue; } @@ -3002,8 +3156,13 @@ void Item_Text_AutoWrapped_Paint(itemDef_t *item) { if (*p == '\0') { break; } - // - y += height + 5; + + //Makro - fixed height + if (item->textHeight) { + y += (item->textHeight); + } else { + y += height + 5; + } p = newLinePtr; len = 0; newLine = 0; @@ -4343,6 +4502,39 @@ void Menu_HandleMouseMove(menuDef_t *menu, float x, float y) { } +//Makro - timer actions +void UI_RQ3_HandleTimer(menuDef_t *menu) { + if (menu) { + if (menu->timerEnabled) { + if (DC->realTime > menu->nextTimer) { + if (menu->timerPos+1 > menu->timedItems) { + menu->timerEnabled = qfalse; + if (menu->onFinishTimer && menu->itemCount>0) { + Item_RunScript(menu->items[0], menu->onFinishTimer); + } + } else { + int i; + menu->nextTimer = DC->realTime + menu->timerInterval; + + for (i=0; iitemCount; i++) { + if (!Q_stricmp(menu->items[i]->window.group, "timer")) { + if (!Q_stricmp(menu->items[i]->window.name, va("timer%i", menu->timerPos+1))) { + menu->items[i]->window.flags |= WINDOW_VISIBLE; + if (menu->items[i]->onTimer) { + Item_RunScript(menu->items[i], menu->items[i]->onTimer); + } + } else { + menu->items[i]->window.flags &= ~WINDOW_VISIBLE; + } + } + } + menu->timerPos++; + } + } + } + } +} + void Menu_Paint(menuDef_t *menu, qboolean forcePaint) { int i; @@ -4372,6 +4564,9 @@ void Menu_Paint(menuDef_t *menu, qboolean forcePaint) { //UI_DrawHandlePic(menu->window.rect.x, menu->window.rect.y, menu->window.rect.w, menu->window.rect.h, menu->backgroundShader); } + //Makro - handle timers + UI_RQ3_HandleTimer(menu); + // paint the background and or border Window_Paint(&menu->window, menu->fadeAmount, menu->fadeClamp, menu->fadeCycle ); @@ -4497,6 +4692,14 @@ qboolean ItemParse_shortcutKey( itemDef_t *item, int handle ) { return qtrue; } +//Makro - fixed height for autowrapped text +qboolean ItemParse_textHeight( itemDef_t *item, int handle ) { + if (!PC_Float_Parse(handle, &item->textHeight)) { + return qfalse; + } + return qtrue; +} + // name qboolean ItemParse_focusSound( itemDef_t *item, int handle ) { const char *temp; @@ -4948,6 +5151,14 @@ qboolean ItemParse_leaveFocus( itemDef_t *item, int handle ) { return qtrue; } +//Makro - extra action executed when the timer show this item +qboolean ItemParse_onTimer( itemDef_t *item, int handle ) { + if (!PC_Script_Parse(handle, &item->onTimer)) { + return qfalse; + } + return qtrue; +} + qboolean ItemParse_mouseEnter( itemDef_t *item, int handle ) { if (!PC_Script_Parse(handle, &item->mouseEnter)) { return qfalse; @@ -5218,7 +5429,10 @@ qboolean ItemParse_hideCvar( itemDef_t *item, int handle ) { keywordHash_t itemParseKeywords[] = { {"name", ItemParse_name, NULL}, + //Makro - support for shortcut keys {"shortcutkey", ItemParse_shortcutKey, NULL}, + //Makro - fixed text height for autowrapped items + {"textHeight", ItemParse_textHeight, NULL}, {"text", ItemParse_text, NULL}, {"group", ItemParse_group, NULL}, {"asset_model", ItemParse_asset_model, NULL}, @@ -5260,6 +5474,8 @@ keywordHash_t itemParseKeywords[] = { {"background", ItemParse_background, NULL}, {"onFocus", ItemParse_onFocus, NULL}, {"leaveFocus", ItemParse_leaveFocus, NULL}, + //Makro - for timers + {"onTimer", ItemParse_onTimer, NULL}, {"mouseEnter", ItemParse_mouseEnter, NULL}, {"mouseExit", ItemParse_mouseExit, NULL}, {"mouseEnterText", ItemParse_mouseEnterText, NULL}, @@ -5353,7 +5569,8 @@ void Item_InitControls(itemDef_t *item) { listPtr->cursorPos = 0; listPtr->startPos = 0; listPtr->endPos = 0; - listPtr->cursorPos = 0; + //Makro - set twice + //listPtr->cursorPos = 0; } } } @@ -5449,6 +5666,32 @@ qboolean MenuParse_onESC( itemDef_t *item, int handle ) { return qtrue; } +//Makro - executed when all the items in a timed sequence have been shown +qboolean MenuParse_onFinishTimer( itemDef_t *item, int handle ) { + menuDef_t *menu = (menuDef_t*)item; + if (!PC_Script_Parse(handle, &menu->onFinishTimer)) { + return qfalse; + } + return qtrue; +} + +//Makro - timer interval +qboolean MenuParse_timerInterval( itemDef_t *item, int handle ) { + menuDef_t *menu = (menuDef_t*)item; + if (!PC_Int_Parse(handle, &menu->timerInterval)) { + return qfalse; + } + return qtrue; +} + +//Makro - total items in timed sequence +qboolean MenuParse_timedItems( itemDef_t *item, int handle ) { + menuDef_t *menu = (menuDef_t*)item; + if (!PC_Int_Parse(handle, &menu->timedItems)) { + return qfalse; + } + return qtrue; +} qboolean MenuParse_border( itemDef_t *item, int handle ) { @@ -5611,6 +5854,17 @@ qboolean MenuParse_soundLoop( itemDef_t *item, int handle ) { return qtrue; } +//Makro - support for music with intro +qboolean MenuParse_soundIntro( itemDef_t *item, int handle ) { + menuDef_t *menu = (menuDef_t*)item; + + if (!PC_String_Parse(handle, &menu->soundIntro)) { + return qfalse; + } + + return qtrue; +} + qboolean MenuParse_fadeClamp( itemDef_t *item, int handle ) { menuDef_t *menu = (menuDef_t*)item; @@ -5664,6 +5918,12 @@ keywordHash_t menuParseKeywords[] = { {"onOpen", MenuParse_onOpen, NULL}, {"onClose", MenuParse_onClose, NULL}, {"onESC", MenuParse_onESC, NULL}, + //Makro - executed when all the items in a timed sequence have been shown + {"onFinishTimer", MenuParse_onFinishTimer, NULL}, + //Makro - timer interval + {"timerInterval", MenuParse_timerInterval, NULL}, + //Makro - total items in timed sequence + {"timedItems", MenuParse_timedItems, NULL}, {"border", MenuParse_border, NULL}, {"borderSize", MenuParse_borderSize, NULL}, {"backcolor", MenuParse_backcolor, NULL}, @@ -5677,6 +5937,8 @@ keywordHash_t menuParseKeywords[] = { {"ownerdrawFlag", MenuParse_ownerdrawFlag, NULL}, {"outOfBoundsClick", MenuParse_outOfBounds, NULL}, {"soundLoop", MenuParse_soundLoop, NULL}, + //Makro - support for music with intro + {"soundIntro", MenuParse_soundIntro, NULL}, {"itemDef", MenuParse_itemDef, NULL}, {"cinematic", MenuParse_cinematic, NULL}, {"popup", MenuParse_popup, NULL}, @@ -5884,6 +6146,10 @@ static void Menu_CacheContents(menuDef_t *menu) { if (menu->soundName && *menu->soundName) { DC->registerSound(menu->soundName, qfalse); } + //Makro - caching sound intro + if (menu->soundName && *menu->soundIntro) { + DC->registerSound(menu->soundIntro, qfalse); + } } } diff --git a/reaction/ta_ui/ui_shared.h b/reaction/ta_ui/ui_shared.h index a824644d..565f3614 100644 --- a/reaction/ta_ui/ui_shared.h +++ b/reaction/ta_ui/ui_shared.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.8 2002/03/10 22:10:10 makro +// no message +// // Revision 1.7 2002/03/03 21:22:58 makro // no message // @@ -111,7 +114,7 @@ #define SLIDER_THUMB_HEIGHT 20.0 #define NUM_CROSSHAIRS 10 //Makro - for the SSG crosshair preview -#define NUM_SSGCROSSHAIRS 6 +#define NUM_SSGCROSSHAIRS 5 typedef struct { const char *command; @@ -240,6 +243,9 @@ typedef struct itemDef_s { float textalignx; // ( optional ) text alignment x coord float textaligny; // ( optional ) text alignment x coord float textscale; // scale percentage from 72pts + //Makro - fixed height for autowrapped text + float textHeight; + int textStyle; // ( optional ) style, normal and shadowed are it for now const char *text; // display text void *parent; // menu owner @@ -251,6 +257,8 @@ typedef struct itemDef_s { const char *action; // select script const char *onFocus; // select script const char *leaveFocus; // select script + //Makro - extra action executed when the timer show this item + const char *onTimer; const char *cvar; // associated cvar const char *cvarTest; // associated cvar for enable actions const char *enableCvar; // enable, disable, show, or hide based on value, this can contain a list @@ -276,11 +284,19 @@ typedef struct { const char *onOpen; // run when the menu is first opened const char *onClose; // run when the menu is closed const char *onESC; // run when the menu is closed - const char *soundName; // background loop sound for menu +//Makro - executed when all the items in a timed sequence have been shown + const char *onFinishTimer; + const char *soundName; // background loop sound for menu +//Makro - music intro + const char *soundIntro; vec4_t focusColor; // focus color for items vec4_t disableColor; // focus color for items itemDef_t *items[MAX_MENUITEMS]; // items this menu contains + + //Makro - timer is on/off + qboolean timerEnabled; + int nextTimer, timerInterval, timedItems, timerPos; } menuDef_t; typedef struct {