From 5a2a24b8688e8e9c91f6e09650e82d7e55b96534 Mon Sep 17 00:00:00 2001 From: Mari0shi Date: Thu, 11 Jan 2024 12:11:54 +0000 Subject: [PATCH] Draw Character in NiGHTS Attack --- src/lua_skinlib.c | 7 +++++- src/m_menu.c | 55 ++++++++++++++++++++++++++++++++++++++++++----- src/r_skins.c | 6 +++++- src/r_skins.h | 1 + 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 3debd3746..ee5be8d9e 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -54,7 +54,8 @@ enum skin { skin_contspeed, skin_contangle, skin_soundsid, - skin_sprites + skin_sprites, + skin_natkcolor }; static const char *const skin_opt[] = { @@ -94,6 +95,7 @@ static const char *const skin_opt[] = { "contangle", "soundsid", "sprites", + "natkcolor", NULL}; #define UNIMPLEMENTED luaL_error(L, LUA_QL("skin_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", skin_opt[field]) @@ -218,6 +220,9 @@ static int skin_get(lua_State *L) case skin_sprites: LUA_PushUserdata(L, skin->sprites, META_SKINSPRITES); break; + case skin_natkcolor: + lua_pushinteger(L, skin->natkcolor); + break; } return 1; } diff --git a/src/m_menu.c b/src/m_menu.c index 9aae59445..78da84166 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5896,14 +5896,14 @@ static void M_DrawNightsAttackBackground(void) } // NiGHTS Attack floating Super Sonic. -static patch_t *ntssupersonic[2]; +/*static patch_t *ntssupersonic[2]; static void M_DrawNightsAttackSuperSonic(void) { const UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE); INT32 timer = FixedInt(ntsatkdrawtimer/4) % 2; angle_t fa = (FixedAngle((FixedInt(ntsatkdrawtimer * 4) % 360)<>ANGLETOFINESHIFT) & FINEMASK; V_DrawFixedPatch(235<spriteframes[spritetimer]; //Our animation frame is equal to the number on the timer + + NightsAttackSprite = W_CachePatchNum(sprframe->lumppat[6], PU_PATCH); //Draw the right facing angle + + if (skins[skinnumber].natkcolor) //If you set natkcolor use it + color = skins[skinnumber].natkcolor; + else if ((skins[skinnumber].flags & SF_SUPER) && !(skins[skinnumber].flags & SF_NONIGHTSSUPER)) //If you go super in NiGHTS, use supercolor + color = skins[skinnumber].supercolor+4; + else //If you don't go super in NiGHTS or at all, use prefcolor + color = skins[skinnumber].prefcolor; + + + + colormap = R_GetTranslationColormap(TC_BLINK, color, GTC_CACHE); //Make the sprite color be our prefcolor + + angle_t fa = (FixedAngle(((FixedInt(ntsatkdrawtimer * 4)) % 360)<>ANGLETOFINESHIFT) & FINEMASK; + + if (sprframe->flip & 1<<6) //If our sprite is supposed to be flipped + flags = V_FLIP; //Flip it + else + flags = 0; + + + V_DrawFixedPatch((270<width)*3)/2, 135, 0, ngradeletters[bestoverall]); @@ -10348,8 +10393,8 @@ static void M_NightsAttack(INT32 choice) // This is really just to make sure Sonic is the played character, just in case M_PatchSkinNameTable(); - ntssupersonic[0] = W_CachePatchName("NTSSONC1", PU_PATCH); - ntssupersonic[1] = W_CachePatchName("NTSSONC2", PU_PATCH); + //ntssupersonic[0] = W_CachePatchName("NTSSONC1", PU_PATCH); + //ntssupersonic[1] = W_CachePatchName("NTSSONC2", PU_PATCH); G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please diff --git a/src/r_skins.c b/src/r_skins.c index fbc2a30e1..06da17be6 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -149,6 +149,8 @@ static void Sk_SetDefaultValue(skin_t *skin) skin->contspeed = 17; skin->contangle = 0; + skin->natkcolor = SKINCOLOR_NONE; + for (i = 0; i < sfx_skinsoundslot0; i++) if (S_sfx[i].skinsound != -1) skin->soundsid[S_sfx[i].skinsound] = i; @@ -603,7 +605,6 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value) UINT16 color = R_GetSuperColorByName(value); skin->supercolor = (color ? color : SKINCOLOR_SUPERGOLD1); } - #define GETFLOAT(field) else if (!stricmp(stoken, #field)) skin->field = FLOAT_TO_FIXED(atof(value)); GETFLOAT(jumpfactor) GETFLOAT(highresscale) @@ -644,6 +645,9 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value) GETFLAG(NOSHIELDABILITY) #undef GETFLAG + else if (!stricmp(stoken, "natkcolor")) + skin->natkcolor = R_GetColorByName(value); // SKINCOLOR_NONE is allowed here + else // let's check if it's a sound, otherwise error out { boolean found = false; diff --git a/src/r_skins.h b/src/r_skins.h index bf2275a49..5acb415fe 100644 --- a/src/r_skins.h +++ b/src/r_skins.h @@ -70,6 +70,7 @@ typedef struct UINT16 prefcolor; UINT16 supercolor; UINT16 prefoppositecolor; // if 0 use tables instead + UINT16 natkcolor; //Color for Nights Attack Menu fixed_t highresscale; // scale of highres, default is 0.5 UINT8 contspeed; // continue screen animation speed