From 23733acd7f1f65506ca75d601e9612cca47e0e49 Mon Sep 17 00:00:00 2001 From: Izuru Yakumo Date: Sun, 27 Jul 2025 21:21:08 -0300 Subject: [PATCH] kero-kero-o --- code/q3_ui/ui_startserver.c | 166 ++++++++++++++++-------------------- 1 file changed, 75 insertions(+), 91 deletions(-) diff --git a/code/q3_ui/ui_startserver.c b/code/q3_ui/ui_startserver.c index d8bf133..0762646 100644 --- a/code/q3_ui/ui_startserver.c +++ b/code/q3_ui/ui_startserver.c @@ -1317,112 +1317,96 @@ static void ServerOptions_LevelshotDraw( void *self ) { UI_DrawString( x, y, gametype_items[gametype_remap2[s_serveroptions.gametype]], UI_CENTER|UI_SMALLFONT, color_orange ); } - static void ServerOptions_InitBotNames( void ) { - int count; - int n; - const char *arenaInfo; - const char *botInfo; - char *p; - char *bot; - char bots[MAX_INFO_STRING]; + int count; + int n; + const char *arenaInfo; + const char *botInfo; + char *p; + char *bot; + char bots[MAX_INFO_STRING]; - if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS ) { - Q_strncpyz( s_serveroptions.playerNameBuffers[1], "--------", 16 ); - Q_strncpyz( s_serveroptions.playerNameBuffers[2], "--------", 16 ); - Q_strncpyz( s_serveroptions.playerNameBuffers[3], "--------", 16 ); - if( s_serveroptions.gametype != GT_TEAM ) { - s_serveroptions.playerType[3].curvalue = 2; - } - Q_strncpyz( s_serveroptions.playerNameBuffers[4], "--------", 16 ); - s_serveroptions.playerType[4].curvalue = 2; - Q_strncpyz( s_serveroptions.playerNameBuffers[5], "--------", 16 ); - s_serveroptions.playerType[5].curvalue = 2; + if ( s_serveroptions.gametype >= GT_TEAM ) { + Q_strncpyz( s_serveroptions.playerNameBuffers[1], "Reimu", 16 ); + Q_strncpyz( s_serveroptions.playerNameBuffers[2], "Marisa", 16 ); + if ( s_serveroptions.gametype == GT_TEAM ) { + Q_strncpyz( s_serveroptions.playerNameBuffers[3], "Kosuzu", 16 ); + } else { + s_serveroptions.playerType[3].curvalue = 2; + } + s_serveroptions.playerType[4].curvalue = 2; + s_serveroptions.playerType[5].curvalue = 2; - Q_strncpyz( s_serveroptions.playerNameBuffers[6], "--------", 16 ); - Q_strncpyz( s_serveroptions.playerNameBuffers[7], "--------", 16 ); - Q_strncpyz( s_serveroptions.playerNameBuffers[8], "--------", 16 ); - Q_strncpyz( s_serveroptions.playerNameBuffers[9], "--------", 16 ); - if( s_serveroptions.gametype != GT_TEAM ) { - s_serveroptions.playerType[9].curvalue = 2; - } - Q_strncpyz( s_serveroptions.playerNameBuffers[10], "--------", 16 ); - s_serveroptions.playerType[10].curvalue = 2; - Q_strncpyz( s_serveroptions.playerNameBuffers[11], "--------", 16 ); - s_serveroptions.playerType[11].curvalue = 2; + Q_strncpyz( s_serveroptions.playerNameBuffers[6], "Kanako", 16 ); + Q_strncpyz( s_serveroptions.playerNameBuffers[7], "Sanae", 16 ); + Q_strncpyz( s_serveroptions.playerNameBuffers[8], "Suwako", 16 ); + if ( s_serveroptions.gametype == GT_TEAM ) { + Q_strncpyz( s_serveroptions.playerNameBuffers[9], "Aya", 16 ); + } else { + s_serveroptions.playerType[9].curvalue = 2; + } + s_serveroptions.playerType[10].curvalue = 2; + s_serveroptions.playerType[11].curvalue = 2; - return; - } + return; + } - count = 1; // skip the first slot, reserved for a human + // Reserve the first slot for a human + count = 1; + // Get info for this map + arenaInfo = UI_GetArenaInfoByMap( s_serveroptions.mapnamebuffer ); - // get info for this map - arenaInfo = UI_GetArenaInfoByMap( s_serveroptions.mapnamebuffer ); + // Get the bot info, we'll seed with them if any are listed + Q_strncpyz( bots, Info_ValueForKey( arenaInfo, "bots" ), sizeof(bots) ); + p = &bots[0]; + while( *p && count < PLAYER_SLOTS ) { + // Skip spaces + while ( *p && *p == ' ' ) { + p++; + } + if ( !*p ) { + break; + } - // get the bot info - we'll seed with them if any are listed - Q_strncpyz( bots, Info_ValueForKey( arenaInfo, "bots" ), sizeof(bots) ); - p = &bots[0]; - while( *p && count < PLAYER_SLOTS ) { - //skip spaces - while( *p && *p == ' ' ) { - p++; - } - if( !p ) { - break; - } + // Mark start of bot name + bot = p; - // mark start of bot name - bot = p; + // Skip until space of null + while ( *p && *p != ' ' ) { + p++; + } + if ( *p ) { + *p++ = 0; + } - // skip until space of null - while( *p && *p != ' ' ) { - p++; - } - if( *p ) { - *p++ = 0; - } + botInfo = UI_GetBotInfoByName( bot ); + if (!botInfo) { + botInfo = UI_GetBotInfoByNumber( count ); + } + bot = Info_ValueForKey( botInfo, "name" ); - botInfo = UI_GetBotInfoByName( bot ); - bot = Info_ValueForKey( botInfo, "name" ); - - if(!Q_stricmp(bot,"")) - bot = "--------"; + Q_strncpyz( s_serveroptions.playerNameBuffers[count], bot, sizeof(s_serveroptions.playerNameBuffers[count]) ); + count++; + } - Q_strncpyz( s_serveroptions.playerNameBuffers[count], bot, sizeof(s_serveroptions.playerNameBuffers[count]) ); - count++; - } + // Set the rest of bot slots to "---" + for( n = count; n < PLAYER_SLOTS; n++ ) { + strcpy( s_serveroptions.playerNameBuffers[n], "--------" ); + } - // set the rest of the bot slots to to other bots - for( n = count; n < PLAYER_SLOTS; n++ ) { - switch(n%4){ - case 0: - strcpy( s_serveroptions.playerNameBuffers[n], "--------" ); - break; - case 1: - strcpy( s_serveroptions.playerNameBuffers[n], "--------" ); - break; - case 2: - strcpy( s_serveroptions.playerNameBuffers[n], "--------" ); - break; - default: - strcpy( s_serveroptions.playerNameBuffers[n], "--------" ); - } - } + // Pad up to #8 as open slots + for ( ;count < 8; count++ ) { + s_serveroptions.playerType[count].curvalue = 0; + } - // pad up to #8 as open slots - for( ;count < 8; count++ ) { - s_serveroptions.playerType[count].curvalue = 0; - } - - // close off the rest by default - for( ;count < PLAYER_SLOTS; count++ ) { - if( s_serveroptions.playerType[count].curvalue == 1 ) { - s_serveroptions.playerType[count].curvalue = 2; - } - } + // Close off the rest by default + for ( ;count < PLAYER_SLOTS; count++ ) { + if ( s_serveroptions.playerType[count].curvalue == 1 ) { + s_serveroptions.playerType[count].curvalue == 2; + } + } } - void ServerOptions_MenuDraw( void ) { ServerOptions_UpdateMenuItems(); Menu_Draw( &s_serveroptions.menu );