diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 84b4b6d40..0547a262b 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -774,6 +774,17 @@ EXTERN psky_t multipsky[MAXPSKYMULTIS]; // Mapping of multi-sky index to base sky tile number: EXTERN int32_t multipskytile[MAXPSKYMULTIS]; +static inline int32_t getpskyidx(int32_t picnum) +{ + int32_t j; + + for (j=pskynummultis; j>0; j--) // NOTE: j==0 on non-early loop end + if (picnum == multipskytile[j]) + break; // Have a match. + + return j; +} + EXTERN char parallaxtype; // last sprite in the freelist, that is the spritenum for which diff --git a/polymer/eduke32/build/src/engine_priv.h b/polymer/eduke32/build/src/engine_priv.h index 128cf7d6a..d40df0b33 100644 --- a/polymer/eduke32/build/src/engine_priv.h +++ b/polymer/eduke32/build/src/engine_priv.h @@ -216,12 +216,7 @@ static inline void bricolor(palette_t *wpptr, int32_t dacol) // Returns: pointer to tile offset array. Sets-by-pointer the other two. static inline const int8_t *getpsky(int32_t picnum, int32_t *dapyscale, int32_t *dapskybits) { - int32_t j; - - // First, try a multi-sky. - for (j=pskynummultis; j>0; j--) // NOTE: j==0 on non-early loop end - if (picnum == multipskytile[j]) - break; // Have a match. + int32_t j = getpskyidx(picnum); if (dapskybits) *dapskybits = multipsky[j].lognumtiles; diff --git a/polymer/eduke32/source/common.c b/polymer/eduke32/source/common.c index 572eebc65..653b5a29b 100644 --- a/polymer/eduke32/source/common.c +++ b/polymer/eduke32/source/common.c @@ -157,7 +157,6 @@ EDUKE32_STATIC_ASSERT(NUMPSKYMULTIS <= MAXPSKYMULTIS); EDUKE32_STATIC_ASSERT(PSKYOFF_MAX <= MAXPSKYTILES); // Set up new-style multi-psky handling. -// KEEPINSYNC MultiPsky_TileToIdx(). void G_InitMultiPsky(int32_t CLOUDYOCEAN__DYN, int32_t MOONSKY1__DYN, int32_t BIGORBIT1__DYN, int32_t LA__DYN) { int32_t i; @@ -243,7 +242,7 @@ void G_SetupGlobalPsky(void) { if (sector[i].ceilingstat & 1) { - mskyidx = MultiPsky_TileToIdx(sector[i].ceilingpicnum); + mskyidx = getpskyidx(sector[i].ceilingpicnum); if (mskyidx > 0) break; } diff --git a/polymer/eduke32/source/common_game.h b/polymer/eduke32/source/common_game.h index 01350ed96..ddf60bcfc 100644 --- a/polymer/eduke32/source/common_game.h +++ b/polymer/eduke32/source/common_game.h @@ -61,26 +61,6 @@ extern void clearScriptNamePtr(void); extern void G_InitMultiPsky(int32_t CLOUDYOCEAN__DYN, int32_t MOONSKY1__DYN, int32_t BIGORBIT1__DYN, int32_t LA__DYN); extern void G_SetupGlobalPsky(void); -// Get the multi-psky index corresponding to a base tile number of the sky (for -// the game: the *static* value!), or 0 as the catch-all. -// KEEPINSYNC G_InitMultiPsky(). -static inline int32_t MultiPsky_TileToIdx(int32_t tilenum) -{ - switch (tilenum) - { - default: - return 0; - case 78: // CLOUDYOCEAN__STATIC - return 1; - case 80: // MOONSKY1__STATIC: - return 2; - case 84: // BIGORBIT1__STATIC: - return 3; - case 89: // LA__STATIC: - return 4; - } -} - ////////// extern void G_ExtPreInit(void);