From 5c1b09501fc350415b3f1c028af38e635347782c Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Fri, 19 Mar 2004 05:14:11 +0000 Subject: * Fixed TA listbox bug where user could select beyond the length of the list * Hitting K_ENTER when a listbox has focus now invokes its doubleClick handler * You can't use objects when dead any longer * Team change broadcast message fixed --- src/game/g_active.c | 3 ++- src/game/g_buildable.c | 5 +++-- src/game/g_cmds.c | 6 ++++-- src/ui/ui_shared.c | 17 ++++++++++++++++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/game/g_active.c b/src/game/g_active.c index aeb69cd5..0bbe5c82 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1140,7 +1140,8 @@ void ClientThink_real( gentity_t *ent ) client->buttons = ucmd->buttons; client->latched_buttons |= client->buttons & ~client->oldbuttons; - if( ( client->buttons & BUTTON_GETFLAG ) && !( client->oldbuttons & BUTTON_GETFLAG ) ) + if( ( client->buttons & BUTTON_GETFLAG ) && !( client->oldbuttons & BUTTON_GETFLAG ) && + client->ps.stats[ STAT_HEALTH ] > 0 ) { trace_t trace; vec3_t view, point; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index c35e64ec..3ff4da9a 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1068,8 +1068,9 @@ void AHovel_Use( gentity_t *self, gentity_t *other, gentity_t *activator ) //this hovel is in use G_TriggerMenu( activator->client->ps.clientNum, MN_A_HOVEL_OCCUPIED ); } - else if( ( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_BASE ) || - ( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_LEV1 ) ) + else if( ( ( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_BASE ) || + ( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_LEV1 ) ) && + activator->health > 0 ) { if( AHovel_Blocked( self, activator, qfalse ) ) { diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 3a98c468..b24b8526 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -499,8 +499,10 @@ void Cmd_Team_f( gentity_t *ent ) G_ChangeTeam( ent, team ); - if( team == PTE_ALIENS || team == PTE_HUMANS ) - trap_SendServerCommand( -1, va( "print \"%s joined the %s.\n\"", ent->client->pers.netname, s ) ); + if( team == PTE_ALIENS ) + trap_SendServerCommand( -1, va( "print \"%s joined the aliens.\n\"", ent->client->pers.netname ) ); + else if( team == PTE_HUMANS ) + trap_SendServerCommand( -1, va( "print \"%s joined the humans.\n\"", ent->client->pers.netname ) ); } diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index d4bc9ace..77e6c5f5 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -1866,6 +1866,16 @@ qboolean Item_ListBox_HandleKey(itemDef_t *item, int key, qboolean down, qboolea } return qtrue; } + + //TA: invoke the doubleClick handler when enter is pressed + if( key == K_ENTER ) + { + if( listPtr->doubleClick ) + Item_RunScript( item, listPtr->doubleClick ); + + return qtrue; + } + if ( key == K_HOME || key == K_KP_HOME) { // home listPtr->startPos = 0; @@ -3400,6 +3410,7 @@ static bind_t g_bindings[] = { "+attack", K_MOUSE1, -1, -1, -1 }, { "+button5", K_MOUSE2, -1, -1, -1 }, //TA: secondary attack { "reload", 'r', -1, -1, -1 }, //TA: reload + { "buy ammo", 'b', -1, -1, -1 }, //TA: buy ammo { "+button7", 'q', -1, -1, -1 }, //TA: buildable use { "deconstruct", 'e', -1, -1, -1 }, //TA: buildable destroy { "weapprev", '[', -1, -1, -1 }, @@ -3892,7 +3903,8 @@ void Item_Image_Paint(itemDef_t *item) { } void Item_ListBox_Paint(itemDef_t *item) { - float x, y, size, count, i, thumb; + float x, y, size, thumb; + int i, count; qhandle_t image; qhandle_t optionalImage; listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData; @@ -4066,6 +4078,9 @@ void Item_ListBox_Paint(itemDef_t *item) { } } } + + //TA: fix to off-by-one bug + listPtr->endPos--; } -- cgit