📄 st_stuff.c
字号:
//added:28-02-98:quick hack underwater palette /*if (plyr->mo && (plyr->mo->z + (cv_viewheight.value<<FRACBITS) < plyr->mo->waterz) ) palette = RADIATIONPAL;*/ if (palette != st_palette) { st_palette = palette;#ifdef HWRENDER // not win32 only 19990829 by Kin if ( (rendermode == render_opengl) || (rendermode == render_d3d) ) //faB - NOW DO ONLY IN SOFTWARE MODE, LETS FIX THIS FOR GOOD OR NEVER // idea : use a true color gradient from frame to frame, because we // are in true color in HW3D, we can have smoother palette change // than the palettes defined in the wad { //CONS_Printf("palette: %d\n", palette); switch (palette) { case 0x00: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0x0); break; // pas de changement case 0x01: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff373797); break; // red case 0x02: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff373797); break; // red case 0x03: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff3030a7); break; // red case 0x04: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff2727b7); break; // red case 0x05: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff2020c7); break; // red case 0x06: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff1717d7); break; // red case 0x07: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff1010e7); break; // red case 0x08: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff0707f7); break; // red case 0x09: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xffff6060); break; // blue //case 0x0a: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff579787); break; // light green //case 0x0b: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff47a077); break; // light green //case 0x0c: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff37b767); break; // light green case 0x0a: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff70a090); break; // light green case 0x0b: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff67b097); break; // light green case 0x0c: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff60c0a0); break; // light green //case 0x0a: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff829371); break; // light green //case 0x0b: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff809070); break; // light green //case 0x0c: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff788769); break; // light green case 0x0d: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xff60ff60); break; // green case 0x0e: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xffff6060); break; // blue case 0x0f: HWD.pfnSetSpecialState(HWD_SET_PALETTECOLOR, 0xffff6060); break; // blue } } else#endif { if( !cv_splitscreen.value || !palette ) V_SetPalette (palette); } }}static void ST_drawWidgets(boolean refresh){ int i; // used by w_arms[] widgets st_armson = st_statusbaron && !cv_deathmatch.value; // used by w_frags widget st_fragson = cv_deathmatch.value && st_statusbaron; STlib_updateNum(&w_ready, refresh); for (i=0;i<4;i++) { STlib_updateNum(&w_ammo[i], refresh); STlib_updateNum(&w_maxammo[i], refresh); } STlib_updatePercent(&w_health, refresh); STlib_updatePercent(&w_armor, refresh); STlib_updateBinIcon(&w_armsbg, refresh); for (i=0;i<6;i++) STlib_updateMultIcon(&w_arms[i], refresh); STlib_updateMultIcon(&w_faces, refresh); for (i=0;i<3;i++) STlib_updateMultIcon(&w_keyboxes[i], refresh); STlib_updateNum(&w_frags, refresh);}static void ST_doRefresh(void){ // draw status bar background to off-screen buff ST_refreshBackground(); // and refresh all widgets ST_drawWidgets(true);}static void ST_diffDraw(void){ // update all widgets ST_drawWidgets(false);}void ST_Invalidate(void){ st_firsttime = true;}void ST_overlayDrawer ();void ST_Drawer ( boolean refresh ){ st_statusbaron = (cv_viewsize.value<11) || automapactive; if( gamemode == heretic ) { SB_Drawer( refresh ); return; } //added:30-01-98:force a set of the palette by doPaletteStuff() if (vid.recalc) st_palette = -1; // Do red-/gold-shifts from damage/items#ifdef HWRENDER // not win32 only 19990829 by Kin//25/08/99: Hurdler: palette changes is done for all players,// not only player1 ! That's why this part // of code is moved somewhere else. if (rendermode==render_soft)#endif ST_doPaletteStuff(); if( st_statusbaron ) { // after ST_Start(), screen refresh needed, or vid mode change if (st_firsttime || refresh || st_recalc ) { if (st_recalc) //recalc widget coords after vid mode change { ST_createWidgets (); st_recalc = false; } st_firsttime = false; ST_doRefresh(); } else // Otherwise, update as little as possible ST_diffDraw(); } else if( st_overlay ) { if( !playerdeadview || cv_splitscreen.value) { plyr=&players[displayplayer]; ST_overlayDrawer (); } if( cv_splitscreen.value ) { plyr=&players[secondarydisplayplayer]; ST_overlayDrawer (); } }}static void ST_loadGraphics(void){ int i; char namebuf[9]; // Load the numbers, tall and short for (i=0;i<10;i++) { sprintf(namebuf, "STTNUM%d", i); tallnum[i] = (patch_t *) W_CachePatchName(namebuf, PU_STATIC); sprintf(namebuf, "STYSNUM%d", i); shortnum[i] = (patch_t *) W_CachePatchName(namebuf, PU_STATIC); } // Load percent key. //Note: why not load STMINUS here, too? tallpercent = (patch_t *) W_CachePatchName("STTPRCNT", PU_STATIC); // key cards for (i=0;i<NUMCARDS;i++) { sprintf(namebuf, "STKEYS%d", i); keys[i] = (patch_t *) W_CachePatchName(namebuf, PU_STATIC); } // arms background armsbg = (patch_t *) W_CachePatchName("STARMS", PU_STATIC); // arms ownership widgets for (i=0;i<6;i++) { sprintf(namebuf, "STGNUM%d", i+2); // gray # arms[i][0] = (patch_t *) W_CachePatchName(namebuf, PU_STATIC); // yellow # arms[i][1] = shortnum[i+2]; } // status bar background bits sbar = (patch_t *) W_CachePatchName("STBAR", PU_STATIC); // the original Doom uses 'STF' as base name for all face graphics ST_loadFaceGraphics ("STF");}// made separate so that skins code can reload custom face graphicsvoid ST_loadFaceGraphics (char *facestr){ int i,j; int facenum; char namelump[9]; char* namebuf; //hack: make sure base face name is no more than 3 chars // bug: core dump fixed 19990220 by Kin if( strlen(facestr)>3 ) facestr[3]='\0'; strcpy (namelump, facestr); // copy base name namebuf = namelump; while (*namebuf>' ') namebuf++; // face states facenum = 0; for (i=0;i<ST_NUMPAINFACES;i++) { for (j=0;j<ST_NUMSTRAIGHTFACES;j++) { sprintf(namebuf, "ST%d%d", i, j); faces[facenum++] = W_CachePatchName(namelump, PU_STATIC); } sprintf(namebuf, "TR%d0", i); // turn right faces[facenum++] = W_CachePatchName(namelump, PU_STATIC); sprintf(namebuf, "TL%d0", i); // turn left faces[facenum++] = W_CachePatchName(namelump, PU_STATIC); sprintf(namebuf, "OUCH%d", i); // ouch! faces[facenum++] = W_CachePatchName(namelump, PU_STATIC); sprintf(namebuf, "EVL%d", i); // evil grin ;) faces[facenum++] = W_CachePatchName(namelump, PU_STATIC); sprintf(namebuf, "KILL%d", i); // pissed off faces[facenum++] = W_CachePatchName(namelump, PU_STATIC); } strcpy (namebuf, "GOD0"); faces[facenum++] = W_CachePatchName(namelump, PU_STATIC); strcpy (namebuf, "DEAD0"); faces[facenum++] = W_CachePatchName(namelump, PU_STATIC); // face backgrounds for different player colors //added:08-02-98: uses only STFB0, which is remapped to the right // colors using the player translation tables, so if // you add new player colors, it is automatically // used for the statusbar. strcpy (namebuf, "B0"); i = W_CheckNumForName(namelump); if( i!=-1 ) faceback = (patch_t *) W_CachePatchNum(i, PU_STATIC); else faceback = (patch_t *) W_CachePatchName("STFB0", PU_STATIC); ST_Invalidate();}static void ST_loadData(void){ ST_loadGraphics();}void ST_unloadGraphics(void){ int i; //faB: GlidePatch_t are always purgeable if (rendermode==render_soft) { // unload the numbers, tall and short for (i=0;i<10;i++) { Z_ChangeTag(tallnum[i], PU_CACHE); Z_ChangeTag(shortnum[i], PU_CACHE); } // unload tall percent Z_ChangeTag(tallpercent, PU_CACHE); // unload arms background Z_ChangeTag(armsbg, PU_CACHE); // unload gray #'s for (i=0;i<6;i++) Z_ChangeTag(arms[i][0], PU_CACHE); // unload the key cards for (i=0;i<NUMCARDS;i++) Z_ChangeTag(keys[i], PU_CACHE); Z_ChangeTag(sbar, PU_CACHE); } ST_unloadFaceGraphics (); // Note: nobody ain't seen no unloading // of stminus yet. Dude.}// made separate so that skins code can reload custom face graphicsvoid ST_unloadFaceGraphics (void){ int i; //faB: GlidePatch_t are always purgeable if (rendermode==render_soft) { for (i=0;i<ST_NUMFACES;i++) Z_ChangeTag(faces[i], PU_CACHE); // face background Z_ChangeTag(faceback, PU_CACHE); }}void ST_unloadData(void){ ST_unloadGraphics();}void ST_initData(void){ int i; st_firsttime = true; //added:16-01-98:'link' the statusbar display to a player, which could be // another player than consoleplayer, for example, when you // change the view in a multiplayer demo with F12. if (singledemo) statusbarplayer = displayplayer; else statusbarplayer = consoleplayer; plyr = &players[statusbarplayer]; st_clock = 0; st_chatstate = StartChatState; st_statusbaron = true; st_oldchat = st_chat = false; st_cursoron = false; st_faceindex = 0; st_palette = -1; st_oldhealth = -1; for (i=0;i<NUMWEAPONS;i++) oldweaponsowned[i] = plyr->weaponowned[i]; for (i=0;i<3;i++) keyboxes[i] = -1; STlib_init();}void ST_CalcPos(void){ if( cv_scalestatusbar.value || cv_viewsize.value>=11 ) { fgbuffer = FG | V_SCALESTART; // scale patch by default st_scalex = vid.dupx; st_scaley = vid.dupy; #ifdef HWRENDER if( rendermode != render_soft ) { st_x = 0; ST_Y = BASEVIDHEIGHT - stbarheight; } else#endif { st_x = ((vid.width-ST_WIDTH*vid.dupx)>>1)/vid.dupx; ST_Y = (vid.height - stbarheight)/vid.dupy; } } else { st_scalex = st_scaley = 1; fgbuffer = FG | V_NOSCALEPATCH | V_NOSCALESTART; ST_Y = vid.height - stbarheight; st_x = (vid.width-ST_WIDTH)>>1; }}//added:30-01-98: NOTE: this is called at any level start, view change,// and after vid mode change.void ST_createWidgets(void){ int i; ST_CalcPos(); // ready weapon ammo STlib_initNum(&w_ready, st_x + ST_AMMOX, ST_AMMOY,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -