summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_weapons.c7
-rw-r--r--src/game/bg_public.h3
-rw-r--r--src/game/g_missile.c4
-rw-r--r--src/ui/ui_local.h18
-rw-r--r--src/ui/ui_main.c168
-rw-r--r--ui/menudef.h17
-rw-r--r--ui/tremulous_teamselect.menu18
7 files changed, 212 insertions, 23 deletions
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index 55c0ff73..21527d52 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -989,6 +989,7 @@ static void CG_FlameTrail( centity_t *cent, vec3_t origin )
vec3_t forward, right, up;
vec3_t muzzlePoint;
vec3_t velocity;
+ vec3_t pVelocity;
if( cent->currentState.weapon != WP_FLAMER )
return;
@@ -1001,7 +1002,7 @@ static void CG_FlameTrail( centity_t *cent, vec3_t origin )
{
AngleVectors( cg.refdefViewAngles, forward, right, up );
VectorCopy( cg.refdef.vieworg, muzzlePoint );
- VectorMA( cg.predictedPlayerState.velocity, FIREBALL_SPEED, forward, velocity );
+ VectorScale( cg.predictedPlayerState.velocity, FIREBALL_LAG, pVelocity );
}
else
{
@@ -1010,8 +1011,10 @@ static void CG_FlameTrail( centity_t *cent, vec3_t origin )
//FIXME: this is gonna look weird when crouching
muzzlePoint[ 2 ] += DEFAULT_VIEWHEIGHT;
- VectorMA( cent->currentState.pos.trDelta, FIREBALL_SPEED, forward, velocity );
+ VectorScale( cent->currentState.pos.trDelta, FIREBALL_LAG, pVelocity );
}
+
+ VectorMA( pVelocity, FIREBALL_SPEED, forward, velocity );
//FIXME: tweak these numbers when (if?) the flamer model is done
VectorMA( muzzlePoint, 24.0f, forward, muzzlePoint );
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 50e6b212..438e2453 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -321,7 +321,8 @@ typedef enum {
//TA: needed client side to size sprites
#define FIREBALL_LIFETIME 1000.0f
#define FIREBALL_SPEED 200.0f
-#define FIREBALL_GAP 15 //basically as fast as possible yet regular
+#define FIREBALL_GAP 15 //basically as fast as possible yet regular
+#define FIREBALL_LAG 0.5f //the amount of player velocity that is added to the fireball
typedef enum
{
diff --git a/src/game/g_missile.c b/src/game/g_missile.c
index 193c7404..942697eb 100644
--- a/src/game/g_missile.c
+++ b/src/game/g_missile.c
@@ -243,6 +243,7 @@ fire_flamer
gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t dir )
{
gentity_t *bolt;
+ vec3_t pvel;
VectorNormalize (dir);
@@ -266,7 +267,8 @@ gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t dir )
bolt->s.pos.trType = TR_LINEAR;
bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame
VectorCopy( start, bolt->s.pos.trBase );
- VectorMA( self->client->ps.velocity, FIREBALL_SPEED, dir, bolt->s.pos.trDelta );
+ VectorScale( self->client->ps.velocity, FIREBALL_LAG, pvel );
+ VectorMA( pvel, FIREBALL_SPEED, dir, bolt->s.pos.trDelta );
SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
VectorCopy (start, bolt->r.currentOrigin);
diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h
index 98626059..6079e867 100644
--- a/src/ui/ui_local.h
+++ b/src/ui/ui_local.h
@@ -749,10 +749,21 @@ typedef struct {
} modInfo_t;
//TA: tremulous menus
+#define MAX_INFOPANE_LINES 16
+#define MAX_INFOPANES 16
+
typedef struct
{
- const char *text;
- const char *cmd;
+ const char *name;
+ const char *lines[ MAX_INFOPANE_LINES ];
+ int numLines;
+} tremInfoPane_t;
+
+typedef struct
+{
+ const char *text;
+ const char *cmd;
+ tremInfoPane_t *infopane;
} tremMenuItem_t;
//TA: tremulous menus
@@ -815,6 +826,9 @@ typedef struct {
int movieIndex;
int previewMovie;
+ tremInfoPane_t tremInfoPanes[ MAX_INFOPANES ];
+ int tremInfoPaneCount;
+
//TA: tremulous menus
tremMenuItem_t tremTeamList[ 3 ];
int tremTeamCount;
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 55da8aa9..abf61bf3 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -917,6 +917,133 @@ void UI_ParseMenu(const char *menuFile) {
trap_PC_FreeSource(handle);
}
+/*
+===============
+UI_FindInfoPaneByName
+===============
+*/
+tremInfoPane_t *UI_FindInfoPaneByName( const char *name )
+{
+ int i;
+
+ for( i = 0; i < uiInfo.tremInfoPaneCount; i++ )
+ {
+ if( !Q_stricmp( uiInfo.tremInfoPanes[ i ].name, name ) )
+ return &uiInfo.tremInfoPanes[ i ];
+ }
+
+ return NULL;
+}
+
+/*
+===============
+UI_LoadInfoPane
+===============
+*/
+qboolean UI_LoadInfoPane( int handle )
+{
+ pc_token_t token;
+ qboolean valid = qfalse;
+
+ while( 1 )
+ {
+ memset( &token, 0, sizeof( pc_token_t ) );
+
+ if( !trap_PC_ReadToken( handle, &token ) )
+ break;
+
+ if( !Q_stricmp( token.string, "name" ) )
+ {
+ memset( &token, 0, sizeof( pc_token_t ) );
+
+ if( !trap_PC_ReadToken( handle, &token ) )
+ break;
+
+ uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].name = String_Alloc( token.string );
+ valid = qtrue;
+ }
+ else if( !Q_stricmp( token.string, "line" ) )
+ {
+ int *line;
+
+ memset( &token, 0, sizeof( pc_token_t ) );
+
+ if( !trap_PC_ReadToken( handle, &token ) )
+ break;
+
+ line = &uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].numLines;
+
+ uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].lines[ *line ] = String_Alloc( token.string );
+
+ //increment lines
+ (*line)++;
+
+ if( *line == MAX_INFOPANE_LINES )
+ break;
+ }
+ else if( token.string[ 0 ] == '}' )
+ {
+ //reached the end, break
+ break;
+ }
+ else
+ break;
+ }
+
+ if( valid )
+ {
+ uiInfo.tremInfoPaneCount++;
+ return qtrue;
+ }
+ else
+ {
+ uiInfo.tremInfoPanes[ uiInfo.tremInfoPaneCount ].numLines = 0;
+ return qfalse;
+ }
+}
+
+/*
+===============
+UI_LoadInfoPanes
+===============
+*/
+void UI_LoadInfoPanes( const char *file )
+{
+ pc_token_t token;
+ int handle;
+ int count;
+
+ uiInfo.tremInfoPaneCount = 0;
+
+ handle = trap_PC_LoadSource( file );
+
+ if( !handle )
+ {
+ trap_Error( va( S_COLOR_YELLOW "infopane file not found: %s\n", file ) );
+ return;
+ }
+
+ while( 1 )
+ {
+ if( !trap_PC_ReadToken( handle, &token ) )
+ break;
+
+ if( token.string[ 0 ] == 0 )
+ break;
+
+ if( token.string[ 0 ] == '{' )
+ {
+ if( UI_LoadInfoPane( handle ) )
+ count++;
+
+ if( count == MAX_INFOPANES )
+ break;
+ }
+ }
+
+ trap_PC_FreeSource( handle );
+}
+
qboolean Load_Menu(int handle) {
pc_token_t token;
@@ -1157,6 +1284,26 @@ static void UI_DrawDialogText( rectDef_t *rect, float scale, vec4_t color,
Text_Paint( rect->x, rect->y, scale, color, text, 0, 0, textStyle );
}
+static void UI_RenderInfoPane( tremInfoPane_t *pane, rectDef_t *rect, float scale, vec4_t color, int textStyle )
+{
+ int i;
+
+ for( i = 0; i < pane->numLines; i++ )
+ {
+ int height = Text_Height( pane->lines[ i ], scale, 0 );
+
+ Text_Paint( rect->x, rect->y + i * height * 1.5, scale, color, pane->lines[ i ], 0, 0, textStyle );
+ }
+}
+
+static void UI_DrawTeamInfoPane( rectDef_t *rect, float scale, vec4_t color, int textStyle )
+{
+ tremInfoPane_t *pane = NULL;
+
+ if( pane = uiInfo.tremTeamList[ uiInfo.tremTeamIndex ].infopane )
+ UI_RenderInfoPane( pane, rect, scale, color, textStyle );
+}
+
static void UI_DrawSkill(rectDef_t *rect, float scale, vec4_t color, int textStyle) {
int i;
@@ -2011,6 +2158,10 @@ static void UI_OwnerDraw(float x, float y, float w, float h, float text_x, float
UI_DrawDialogText( &rect, scale, color, textStyle );
break;
+ case UI_TEAMINFOPANE:
+ UI_DrawTeamInfoPane( &rect, scale, color, textStyle );
+ break;
+
case UI_HANDICAP:
UI_DrawHandicap(&rect, scale, color, textStyle);
break;
@@ -2871,12 +3022,15 @@ static void UI_LoadTremTeams( )
uiInfo.tremTeamCount = 3;
uiInfo.tremTeamList[ 0 ].text = String_Alloc( "Aliens" );
uiInfo.tremTeamList[ 0 ].cmd = String_Alloc( "cmd team aliens" );
+ uiInfo.tremTeamList[ 0 ].infopane = UI_FindInfoPaneByName( "alienteam" );
uiInfo.tremTeamList[ 1 ].text = String_Alloc( "Humans" );
uiInfo.tremTeamList[ 1 ].cmd = String_Alloc( "cmd team humans" );
+ uiInfo.tremTeamList[ 1 ].infopane = UI_FindInfoPaneByName( "humanteam" );
uiInfo.tremTeamList[ 2 ].text = String_Alloc( "Spectate" );
uiInfo.tremTeamList[ 2 ].cmd = String_Alloc( "cmd team spectate" );
+ uiInfo.tremTeamList[ 2 ].infopane = UI_FindInfoPaneByName( "spectateteam" );
}
/*
@@ -5603,6 +5757,20 @@ void _UI_Init( qboolean inGameLoad ) {
UI_LoadMenus(menuSet, qtrue);
UI_LoadMenus("ui/ingame.txt", qfalse);
UI_LoadMenus("ui/tremulous.txt", qfalse);
+
+ UI_LoadInfoPanes( "ui/infopanes.def" );
+
+ {
+ int ijk, abc;
+
+ for( ijk = 0; ijk < uiInfo.tremInfoPaneCount; ijk++ )
+ {
+ Com_Printf( "name: %s\n", uiInfo.tremInfoPanes[ ijk ].name );
+
+ for( abc = 0; abc < uiInfo.tremInfoPanes[ ijk ].numLines; abc++ )
+ Com_Printf( "line %d: %s\n", abc, uiInfo.tremInfoPanes[ ijk ].lines[ abc ] );
+ }
+ }
#endif
Menus_CloseAll();
diff --git a/ui/menudef.h b/ui/menudef.h
index 4f808a1c..7f3afe57 100644
--- a/ui/menudef.h
+++ b/ui/menudef.h
@@ -256,16 +256,17 @@
#define UI_SERVERREFRESHDATE 247
#define UI_SERVERMOTD 248
#define UI_GLINFO 249
-#define UI_KEYBINDSTATUS 250
-#define UI_CLANCINEMATIC 251
-#define UI_MAP_TIMETOBEAT 252
-#define UI_JOINGAMETYPE 253
-#define UI_PREVIEWCINEMATIC 254
-#define UI_STARTMAPCINEMATIC 255
-#define UI_MAPS_SELECTION 256
+#define UI_KEYBINDSTATUS 250
+#define UI_CLANCINEMATIC 251
+#define UI_MAP_TIMETOBEAT 252
+#define UI_JOINGAMETYPE 253
+#define UI_PREVIEWCINEMATIC 254
+#define UI_STARTMAPCINEMATIC 255
+#define UI_MAPS_SELECTION 256
//TA:
-#define UI_DIALOG 257
+#define UI_DIALOG 257
+#define UI_TEAMINFOPANE 258
#define VOICECHAT_GETFLAG "getflag" // command someone to get the flag
#define VOICECHAT_OFFENSE "offense" // command someone to go on offense
diff --git a/ui/tremulous_teamselect.menu b/ui/tremulous_teamselect.menu
index e385c4df..d501f7a5 100644
--- a/ui/tremulous_teamselect.menu
+++ b/ui/tremulous_teamselect.menu
@@ -33,18 +33,18 @@
itemDef
{
- name "infopane"
- text "Put some info here based on selection"
- textalignx 5
- textaligny 15
+ name infopane
+ ownerdraw UI_TEAMINFOPANE
+ textstyle ITEM_TEXTSTYLE_NORMAL
+ style WINDOW_STYLE_FILLED
rect 170 10 220 155
- type ITEM_TYPE_TEXT
- style WINDOW_STYLE_FILLED
+ textalignx 5
+ textaligny 18
textscale .25
forecolor 1 1 1 1
- backcolor 0 0 .5 .25
- outlinecolor .1 .1 .7 .5
- visible 1
+ backcolor .5 0 0 .25
+ visible 1
+ decoration
}
itemDef