// // D_InitGMIPostWads // // haleyjd 11/12/09: Conditionally applies missioninfo overrides which are // contingent upon the presence of certain lumps. This must be called after // W_InitMultipleFiles (and is done so immediately afterward), in order to // account for any PWADs loaded. // // 07/15/2012: Added runtime adjustment of blackIndex and whiteIndex. // void D_InitGMIPostWads(void) { AutoPalette pal(wGlobalDir); gamemodeinfo_t *gi = GameModeInfo; missioninfo_t *mi = gi->missionInfo; // apply the demoStates override from the missioninfo conditionally: // * if MI_DEMOIFDEMO4 is not set, then always override. // * if MI_DEMOIFDEMO4 IS set, then only if DEMO4 actually exists. if(!(mi->flags & MI_DEMOIFDEMO4) || W_CheckNumForName("DEMO4") >= 0) OVERRIDE(demoStates, NULL); GameModeInfo->blackIndex = V_FindBestColor(pal.get(), 0, 0, 0); GameModeInfo->whiteIndex = V_FindBestColor(pal.get(), 255, 255, 255); }
void P_InitParticleEffects(void) { AutoPalette palette(wGlobalDir); struct particleColorList *pc = particleColors; // match particle colors to best fit and write back to // static variables while(pc->color) { *(pc->color) = V_FindBestColor(palette.get(), pc->r, pc->g, pc->b); pc++; } P_GenVelocities(); }
// // E_ColorStrCB // // Accepts either a palette index or an RGB triplet, which will be // matched to the closest color in the game palette. // int E_ColorStrCB(cfg_t *cfg, cfg_opt_t *opt, const char *value, void *result) { char *endptr; *(int *)result = (int)strtol(value, &endptr, 0); if(*endptr != '\0') { AutoPalette pal(wGlobalDir); int r, g, b; if(sscanf(value, "%d %d %d", &r, &g, &b) != 3) { if(cfg) { cfg_error(cfg, "invalid color triplet for option '%s'\n", opt->name); } return -1; } *(int *)result = V_FindBestColor(pal.get(), r, g, b); } else if(errno == ERANGE) { if(cfg) { cfg_error(cfg, "integer value for option '%s' is out of range\n", opt->name); } return -1; } return 0; }