mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
First attempt at multiplayer menus
This commit is contained in:
parent
b4af07ffed
commit
04bd3efd5b
4 changed files with 200 additions and 2 deletions
36
src/k_menu.h
36
src/k_menu.h
|
|
@ -180,6 +180,12 @@ extern menu_t PLAY_LevelSelectDef;
|
|||
extern menuitem_t PLAY_TimeAttack[];
|
||||
extern menu_t PLAY_TimeAttackDef;
|
||||
|
||||
extern menuitem_t PLAY_MP_OptSelect[];
|
||||
extern menu_t PLAY_MP_OptSelectDef;
|
||||
|
||||
extern menuitem_t PLAY_MP_RoomSelect[];
|
||||
extern menu_t PLAY_MP_RoomSelectDef;
|
||||
|
||||
extern menuitem_t PLAY_BattleGamemodesMenu[];
|
||||
extern menu_t PLAY_BattleGamemodesDef;
|
||||
|
||||
|
|
@ -348,6 +354,31 @@ void M_CupSelectTick(void);
|
|||
void M_LevelSelectHandler(INT32 choice);
|
||||
void M_LevelSelectTick(void);
|
||||
|
||||
// Multiplayer menu stuff
|
||||
|
||||
// Keep track of multiplayer menu related data
|
||||
// We'll add more stuff here as we need em...
|
||||
|
||||
extern struct mpmenu_s {
|
||||
UINT8 modechoice;
|
||||
|
||||
UINT8 room;
|
||||
|
||||
tic_t ticker;
|
||||
} mpmenu;
|
||||
|
||||
// MP selection
|
||||
void M_MPOptSelect(INT32 choice);
|
||||
void M_MPOptSelectInit(INT32 choice);
|
||||
void M_MPOptSelectTick(void);
|
||||
|
||||
// Server browser room selection
|
||||
void M_MPRoomSelect(INT32 choice);
|
||||
void M_MPRoomSelectTick(void);
|
||||
void M_MPRoomSelectInit(INT32 choice);
|
||||
|
||||
// Replay Playback
|
||||
|
||||
extern tic_t playback_last_menu_interaction_leveltime;
|
||||
|
||||
void M_EndModeAttackRun(void);
|
||||
|
|
@ -381,6 +412,11 @@ void M_DrawCupSelect(void);
|
|||
void M_DrawLevelSelect(void);
|
||||
void M_DrawTimeAttack(void);
|
||||
|
||||
// Multiplayer menu stuff
|
||||
void M_DrawMPOptSelect(void);
|
||||
void M_DrawMPRoomSelect(void);
|
||||
|
||||
// Replay Playback
|
||||
void M_DrawPlaybackMenu(void);
|
||||
|
||||
// These defines make it a little easier to make menus
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ menuitem_t PLAY_MainMenu[] =
|
|||
{IT_STRING | IT_SUBMENU, "Local Play", "Play only on this computer.",
|
||||
NULL, &PLAY_GamemodesDef, 0, 0},
|
||||
|
||||
{IT_STRING, "Online", "Connect to other computers.",
|
||||
NULL, NULL, 0, 0},
|
||||
{IT_STRING | IT_CALL, "Online", "Connect to other computers.",
|
||||
NULL, M_MPOptSelectInit, /*M_MPRoomSelectInit,*/ 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "Back", NULL, NULL, M_GoBack, 0, 0},
|
||||
};
|
||||
|
|
@ -171,6 +171,44 @@ menuitem_t PLAY_BattleGamemodesMenu[] =
|
|||
|
||||
menu_t PLAY_BattleGamemodesDef = KARTGAMEMODEMENU(PLAY_BattleGamemodesMenu, &PLAY_GamemodesDef);
|
||||
|
||||
// MULTIPLAYER OPTION SELECT
|
||||
menuitem_t PLAY_MP_OptSelect[] =
|
||||
{
|
||||
{IT_NOTHING | IT_KEYHANDLER, NULL, NULL, NULL, M_MPOptSelect, 0, 0},
|
||||
};
|
||||
|
||||
menu_t PLAY_MP_OptSelectDef = {
|
||||
sizeof (PLAY_MP_OptSelect) / sizeof (menuitem_t),
|
||||
&PLAY_MainDef,
|
||||
0,
|
||||
PLAY_MP_OptSelect,
|
||||
0, 0,
|
||||
0, 0,
|
||||
M_DrawMPOptSelect,
|
||||
M_MPOptSelectTick,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
// MULTIPLAYER ROOM SELECT (CORE / MODDED)
|
||||
menuitem_t PLAY_MP_RoomSelect[] =
|
||||
{
|
||||
{IT_NOTHING | IT_KEYHANDLER, NULL, NULL, NULL, M_MPRoomSelect, 0, 0},
|
||||
};
|
||||
|
||||
menu_t PLAY_MP_RoomSelectDef = {
|
||||
sizeof (PLAY_MP_RoomSelect) / sizeof (menuitem_t),
|
||||
&PLAY_MP_OptSelectDef,
|
||||
0,
|
||||
PLAY_MP_RoomSelect,
|
||||
0, 0,
|
||||
0, 0,
|
||||
M_DrawMPRoomSelect,
|
||||
M_MPRoomSelectTick,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
// -------------------
|
||||
// In-game/pause menus
|
||||
// -------------------
|
||||
|
|
|
|||
|
|
@ -1305,6 +1305,64 @@ void M_DrawTimeAttack(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Multiplayer mode option select
|
||||
void M_DrawMPOptSelect(void)
|
||||
{
|
||||
|
||||
patch_t *background = W_CachePatchName("M_EGGACH", PU_CACHE);
|
||||
|
||||
V_DrawFill(0, 0, 999, 999, 25);
|
||||
V_DrawFixedPatch(160<<FRACBITS, 100<<FRACBITS, FRACUNIT, 0, background, NULL);
|
||||
}
|
||||
|
||||
// Multiplayer room select
|
||||
void M_DrawMPRoomSelect(void)
|
||||
{
|
||||
// Greyscale colormaps for the option that's not selected's background
|
||||
UINT8 *colormap_l = NULL;
|
||||
UINT8 *colormap_r = NULL;
|
||||
|
||||
patch_t *bg_l = W_CachePatchName("BG_MPS21", PU_CACHE);
|
||||
patch_t *bg_r = W_CachePatchName("BG_MPS22", PU_CACHE);
|
||||
|
||||
patch_t *split = W_CachePatchName("MPSPLIT1", PU_CACHE);
|
||||
|
||||
patch_t *butt1[] = {W_CachePatchName("MP_B1", PU_CACHE), W_CachePatchName("MP_B12", PU_CACHE)};
|
||||
patch_t *butt2[] = {W_CachePatchName("MP_B2", PU_CACHE), W_CachePatchName("MP_B22", PU_CACHE)};
|
||||
|
||||
patch_t *scrollp[] = {W_CachePatchName("MP_SCR1", PU_CACHE), W_CachePatchName("MP_SCR2", PU_CACHE)};
|
||||
patch_t *drawp = scrollp[mpmenu.room];
|
||||
|
||||
fixed_t scrollposx[] = {(BASEVIDWIDTH/4)<<FRACBITS, (BASEVIDWIDTH/2 + BASEVIDWIDTH/4)<<FRACBITS};
|
||||
UINT8 i;
|
||||
INT32 soffy = 0;
|
||||
|
||||
if (mpmenu.room)
|
||||
colormap_l = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_GREY, GTC_CACHE);
|
||||
else
|
||||
colormap_r = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_GREY, GTC_CACHE);
|
||||
|
||||
// Draw the 2 sides of the background
|
||||
V_DrawFixedPatch(0, 0, FRACUNIT, 0, bg_l, colormap_l);
|
||||
V_DrawFixedPatch(0, 0, FRACUNIT, 0, bg_r, colormap_r);
|
||||
|
||||
|
||||
// Draw the black split:
|
||||
V_DrawFixedPatch(160<<FRACBITS, 0, FRACUNIT, 0, split, NULL);
|
||||
|
||||
// Vertical scrolling stuff
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
V_DrawFixedPatch(scrollposx[mpmenu.room], ((-((mpmenu.ticker*2) % drawp->height)) + soffy)*FRACUNIT , FRACUNIT, V_ADD, drawp, NULL);
|
||||
soffy += scrollp[mpmenu.room]->height;
|
||||
}
|
||||
|
||||
|
||||
// Draw buttons:
|
||||
V_DrawFixedPatch(160<<FRACBITS, 100<<FRACBITS, FRACUNIT, mpmenu.room ? (5<<V_ALPHASHIFT) : 0, butt1[(mpmenu.room) ? 1 : 0], NULL);
|
||||
V_DrawFixedPatch(160<<FRACBITS, 100<<FRACBITS, FRACUNIT, (!mpmenu.room) ? (5<<V_ALPHASHIFT) : 0, butt2[(!mpmenu.room) ? 1 : 0], NULL);
|
||||
}
|
||||
|
||||
//
|
||||
// INGAME / PAUSE MENUS
|
||||
//
|
||||
|
|
|
|||
|
|
@ -2604,6 +2604,72 @@ void M_LevelSelectTick(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct mpmenu_s mpmenu;
|
||||
|
||||
// MULTIPLAYER OPTION SELECT
|
||||
void M_MPOptSelect(INT32 choice)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void M_MPOptSelectInit(INT32 chocie)
|
||||
{
|
||||
mpmenu.modechoice = 0;
|
||||
mpmenu.ticker = 0;
|
||||
|
||||
M_SetupNextMenu(&PLAY_MP_OptSelectDef, false);
|
||||
}
|
||||
|
||||
void M_MPOptSelectTick(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// MULTIPLAYER ROOM SELECT MENU
|
||||
|
||||
void M_MPRoomSelect(INT32 choice)
|
||||
{
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
|
||||
case KEY_LEFTARROW:
|
||||
case KEY_RIGHTARROW:
|
||||
{
|
||||
|
||||
mpmenu.room = (!mpmenu.room) ? 1 : 0;
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case KEY_ESCAPE:
|
||||
{
|
||||
if (currentMenu->prevMenu)
|
||||
M_SetupNextMenu(currentMenu->prevMenu, false);
|
||||
else
|
||||
M_ClearMenus(true);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void M_MPRoomSelectTick(void)
|
||||
{
|
||||
mpmenu.ticker++;
|
||||
}
|
||||
|
||||
void M_MPRoomSelectInit(INT32 choice)
|
||||
{
|
||||
mpmenu.room = 0;
|
||||
mpmenu.ticker = 0;
|
||||
|
||||
M_SetupNextMenu(&PLAY_MP_RoomSelectDef, false);
|
||||
}
|
||||
|
||||
// =====================
|
||||
// PAUSE / IN-GAME MENUS
|
||||
// =====================
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue