Several minor fixes & tweaks for character select

This commit is contained in:
TehRealSalt 2019-10-03 00:13:09 -04:00
parent dae7dd003a
commit 7d8a512d2a
2 changed files with 44 additions and 21 deletions

View file

@ -536,7 +536,7 @@ static void M_DrawCharSelectCircle(setup_player_t *p, INT16 x, INT16 y)
angle_t ang = ((i+1)/2) * angamt; angle_t ang = ((i+1)/2) * angamt;
patch_t *patch = NULL; patch_t *patch = NULL;
UINT8 *colormap; UINT8 *colormap;
fixed_t radius = 24<<FRACBITS; fixed_t radius;
INT16 n; INT16 n;
if (p->mdepth == CSSTEP_ALTS) if (p->mdepth == CSSTEP_ALTS)
@ -553,6 +553,10 @@ static void M_DrawCharSelectCircle(setup_player_t *p, INT16 x, INT16 y)
skin = setup_chargrid[p->gridx][p->gridy].skinlist[n]; skin = setup_chargrid[p->gridx][p->gridy].skinlist[n];
patch = facerankprefix[skin]; patch = facerankprefix[skin];
colormap = R_GetTranslationColormap(skin, skins[skin].prefcolor, GTC_MENUCACHE); colormap = R_GetTranslationColormap(skin, skins[skin].prefcolor, GTC_MENUCACHE);
radius = 24<<FRACBITS;
cx -= (SHORT(patch->width) << FRACBITS) >> 1;
cy -= (SHORT(patch->height) << FRACBITS) >> 1;
} }
else else
{ {
@ -580,11 +584,11 @@ static void M_DrawCharSelectCircle(setup_player_t *p, INT16 x, INT16 y)
else else
patch = W_CachePatchName("COLORSP0", PU_CACHE); patch = W_CachePatchName("COLORSP0", PU_CACHE);
radius -= SHORT(patch->width) << FRACBITS; radius = 28<<FRACBITS;
} //radius -= SHORT(patch->width) << FRACBITS;
cx -= (SHORT(patch->width) << FRACBITS) >> 1; cx -= (SHORT(patch->width) << FRACBITS) >> 1;
cy -= (SHORT(patch->height) << FRACBITS) >> 1; }
if (subtract) if (subtract)
ang = (signed)(ANGLE_90 - ang); ang = (signed)(ANGLE_90 - ang);
@ -677,7 +681,7 @@ static void M_DrawCharSelectPreview(UINT8 num)
if ((setup_animcounter/10) & 1) if ((setup_animcounter/10) & 1)
{ {
if (p->mdepth == CSSTEP_NONE) if (p->mdepth == CSSTEP_NONE && num == setup_numplayers)
V_DrawScaledPatch(x+1, y+36, 0, W_CachePatchName("4PSTART", PU_CACHE)); V_DrawScaledPatch(x+1, y+36, 0, W_CachePatchName("4PSTART", PU_CACHE));
//else if (p->mdepth >= CSSTEP_READY) //else if (p->mdepth >= CSSTEP_READY)
// V_DrawScaledPatch(x+1, y+36, 0, W_CachePatchName("4PREADY", PU_CACHE)); // V_DrawScaledPatch(x+1, y+36, 0, W_CachePatchName("4PREADY", PU_CACHE));
@ -733,10 +737,10 @@ static void M_DrawCharSelectCursors(void)
"CHHOV1", "CHHOV1", "CHHOV1", "CHHOV2", "CHHOV1", "CHHOV3", "CHHOV1", "CHHOV2" "CHHOV1", "CHHOV1", "CHHOV1", "CHHOV2", "CHHOV1", "CHHOV3", "CHHOV1", "CHHOV2"
}; };
static const char *selectframesb[SELECTLEN] = { static const char *selectframesb[SELECTLEN] = {
"CHHOV1", "CHPIKB1", "CHHOV2", "CHPIKB2", "CHHOV3", "CHPIKB3", "CHHOV2", "CHPIKB4", NULL, "CHPIKB1", NULL, "CHPIKB2", NULL, "CHPIKB3", NULL, "CHPIKB4",
"CHHOV1", "CHHOV1", "CHHOV1", "CHHOV2", "CHHOV1", "CHHOV3", "CHHOV1", "CHHOV2", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"CHPIKB5", "CHHOV2", "CHPIKB6", "CHHOV3", "CHPIKB7", "CHHOV2", "CHPIKB8", "CHPIKB5", NULL, "CHPIKB6", NULL, "CHPIKB7", NULL, "CHPIKB8",
"CHHOV1", "CHHOV1", "CHHOV1", "CHHOV2", "CHHOV1", "CHHOV3", "CHHOV1", "CHHOV2" NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
}; };
for (i = 0; i < setup_numplayers; i++) for (i = 0; i < setup_numplayers; i++)
@ -762,7 +766,8 @@ static void M_DrawCharSelectCursors(void)
else if (p->mdepth > CSSTEP_CHARS) else if (p->mdepth > CSSTEP_CHARS)
{ {
V_DrawMappedPatch(x, y, 0, W_CachePatchName(selectframesa[setup_animcounter % SELECTLEN], PU_CACHE), colormap); V_DrawMappedPatch(x, y, 0, W_CachePatchName(selectframesa[setup_animcounter % SELECTLEN], PU_CACHE), colormap);
V_DrawMappedPatch(x, y, V_TRANSLUCENT, W_CachePatchName(selectframesb[(setup_animcounter-1) % SELECTLEN], PU_CACHE), colormap); if (selectframesb[(setup_animcounter-1) % SELECTLEN] != NULL)
V_DrawMappedPatch(x, y, V_TRANSLUCENT, W_CachePatchName(selectframesb[(setup_animcounter-1) % SELECTLEN], PU_CACHE), colormap);
} }
else else
{ {

View file

@ -1684,7 +1684,7 @@ void M_CharacterSelectInit(INT32 choice)
for (j = 0; j < MAXSPLITSCREENPLAYERS; j++) for (j = 0; j < MAXSPLITSCREENPLAYERS; j++)
{ {
if (setup_playercvars[j][SPLITCV_SKIN]->value == i) if (!strcmp(setup_playercvars[j][SPLITCV_SKIN]->string, skins[i].name))
{ {
setup_player[j].gridx = x; setup_player[j].gridx = x;
setup_player[j].gridy = y; setup_player[j].gridy = y;
@ -1743,7 +1743,7 @@ static void M_SetupReadyExplosions(setup_player_t *p)
} }
} }
static void M_HandleCharacterGrid(INT32 choice, setup_player_t *p) static void M_HandleCharacterGrid(INT32 choice, setup_player_t *p, UINT8 num)
{ {
switch (choice) switch (choice)
{ {
@ -1785,8 +1785,15 @@ static void M_HandleCharacterGrid(INT32 choice, setup_player_t *p)
} }
break; break;
case KEY_ESCAPE: case KEY_ESCAPE:
p->mdepth = CSSTEP_NONE; if (num == setup_numplayers-1)
S_StartSound(NULL, sfx_s3k5b); {
p->mdepth = CSSTEP_NONE;
S_StartSound(NULL, sfx_s3k5b);
}
else
{
S_StartSound(NULL, sfx_s3kb2);
}
break; break;
default: default:
break; break;
@ -1838,7 +1845,7 @@ static void M_HandleColorRotate(INT32 choice, setup_player_t *p)
p->color = 1; p->color = 1;
p->rotate = CSROTATETICS; p->rotate = CSROTATETICS;
//p->delay = CSROTATETICS; //p->delay = CSROTATETICS;
S_StartSound(NULL, sfx_s3kc3s); S_StartSound(NULL, sfx_s3k5b); //sfx_s3kc3s
break; break;
case KEY_LEFTARROW: case KEY_LEFTARROW:
p->color--; p->color--;
@ -1846,7 +1853,7 @@ static void M_HandleColorRotate(INT32 choice, setup_player_t *p)
p->color = MAXSKINCOLORS-1; p->color = MAXSKINCOLORS-1;
p->rotate = -CSROTATETICS; p->rotate = -CSROTATETICS;
//p->delay = CSROTATETICS; //p->delay = CSROTATETICS;
S_StartSound(NULL, sfx_s3kc3s); S_StartSound(NULL, sfx_s3k5b); //sfx_s3kc3s
break; break;
case KEY_ENTER: case KEY_ENTER:
p->mdepth = CSSTEP_READY; p->mdepth = CSSTEP_READY;
@ -1882,11 +1889,14 @@ void M_CharacterSelectHandler(INT32 choice)
switch (p->mdepth) switch (p->mdepth)
{ {
case CSSTEP_NONE: // Enter Game case CSSTEP_NONE: // Enter Game
if (choice == KEY_ENTER) if (choice == KEY_ENTER && i == setup_numplayers)
{
p->mdepth = CSSTEP_CHARS; p->mdepth = CSSTEP_CHARS;
S_StartSound(NULL, sfx_s3k65);
}
break; break;
case CSSTEP_CHARS: // Character Select grid case CSSTEP_CHARS: // Character Select grid
M_HandleCharacterGrid(choice, p); M_HandleCharacterGrid(choice, p, i);
break; break;
case CSSTEP_ALTS: // Select clone case CSSTEP_ALTS: // Select clone
M_HandleCharRotate(choice, p); M_HandleCharRotate(choice, p);
@ -1897,7 +1907,10 @@ void M_CharacterSelectHandler(INT32 choice)
case CSSTEP_READY: case CSSTEP_READY:
default: // Unready default: // Unready
if (choice == KEY_ESCAPE) if (choice == KEY_ESCAPE)
{
p->mdepth = CSSTEP_COLORS; p->mdepth = CSSTEP_COLORS;
S_StartSound(NULL, sfx_s3k5b);
}
break; break;
} }
} }
@ -1910,8 +1923,12 @@ void M_CharacterSelectHandler(INT32 choice)
if (p->mdepth < CSSTEP_COLORS) if (p->mdepth < CSSTEP_COLORS)
p->color = skins[p->skin].prefcolor; p->color = skins[p->skin].prefcolor;
}
if (p->mdepth == CSSTEP_NONE) // Setup new numplayers
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
if (setup_player[i].mdepth == CSSTEP_NONE)
break; break;
else else
setup_numplayers = i+1; setup_numplayers = i+1;
@ -1964,10 +1981,11 @@ void M_CharacterSelectTick(void)
{ {
for (i = 0; i < setup_numplayers; i++) for (i = 0; i < setup_numplayers; i++)
{ {
CV_StealthSetValue(setup_playercvars[i][SPLITCV_SKIN], setup_player[i].skin); CV_StealthSet(setup_playercvars[i][SPLITCV_SKIN], skins[setup_player[i].skin].name);
CV_StealthSetValue(setup_playercvars[i][SPLITCV_COLOR], setup_player[i].color); CV_StealthSetValue(setup_playercvars[i][SPLITCV_COLOR], setup_player[i].color);
} }
CV_StealthSetValue(&cv_splitplayers, setup_numplayers);
M_SetupNextMenu(&PLAY_MainDef, false); M_SetupNextMenu(&PLAY_MainDef, false);
} }
} }