void InitSaveshots(qboolean loadmenu) { int i; char shotname [MAX_QPATH]; char mapshotname [MAX_QPATH]; for (i = 1; i < MAX_SAVEGAMES; i++) { // free previously loaded shots Com_sprintf(shotname, sizeof(shotname), "save/kmq2save%i/shot.jpg", i); R_FreePic(shotname); Com_sprintf(shotname, sizeof(shotname), "/save/kmq2save%i/shot.jpg", i); if (R_DrawFindPic(shotname)) { m_saveshotvalid[i] = true; } else { m_saveshotvalid[i] = false; } } if (loadmenu) { // register mapshot for autosave if (m_savevalid[0]) { Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", m_mapname); if (R_DrawFindPic(mapshotname)) { m_mapshotvalid = true; } else { m_mapshotvalid = false; } } else { m_mapshotvalid = false; } } // register null saveshot if (R_DrawFindPic("/gfx/ui/noscreen.pcx")) { m_saveshotvalid[MAX_SAVEGAMES] = true; } else { m_saveshotvalid[MAX_SAVEGAMES] = false; } }
/* * ================= * UI_Draw * ================= */ void UI_Draw(void) { if (cls.key_dest != key_menu) { return; } // dim everything behind it down if ((cl.cinematictime > 0) || (cls.state == ca_disconnected)) { if (R_DrawFindPic("/gfx/ui/menu_background.pcx")) { R_DrawStretchPic(0, 0, viddef.width, viddef.height, "/gfx/ui/menu_background.pcx", 1.0); } else { R_DrawFill(0, 0, viddef.width, viddef.height, 0, 0, 0, 255); } } // ingame menu uses alpha else if (R_DrawFindPic("/gfx/ui/menu_background.pcx")) { R_DrawStretchPic(0, 0, viddef.width, viddef.height, "/gfx/ui/menu_background.pcx", menu_alpha->value); } else { R_DrawFill(0, 0, viddef.width, viddef.height, 0, 0, 0, (int)(menu_alpha->value * 255)); } // Knigthmare- added Psychospaz's mouse support UI_RefreshCursorMenu(); m_drawfunc(); // delay playing the enter sound until after the // menu has been drawn, to avoid delay while // caching images if (m_entersound) { S_StartLocalSound(menu_in_sound); m_entersound = false; } // Knigthmare- added Psychospaz's mouse support //menu cursor for mouse usage :) UI_Draw_Cursor(); }
void PlayerConfig_DrawSkinSelection (void) { char scratch[MAX_QPATH]; float icon_x = SCREEN_WIDTH*0.5 - 5; //width - 325 float icon_y = SCREEN_HEIGHT - 108; float icon_offset = 0; float x, y, w, h; int i, count, color[3]; TextColor((int)Cvar_VariableValue("alt_text_color"), &color[0], &color[1], &color[2]); if (s_pmi[s_player_model_box.curvalue].nskins<NUM_SKINBOX_ITEMS || s_player_skin_box.curvalue<4) i=0; else if (s_player_skin_box.curvalue > s_pmi[s_player_model_box.curvalue].nskins-4) i=s_pmi[s_player_model_box.curvalue].nskins-NUM_SKINBOX_ITEMS; else i=s_player_skin_box.curvalue-3; // left arrow if (i>0) Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_left.pcx"); else Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_left_d.pcx"); SCR_DrawPic (icon_x-39, icon_y+2, 32, 32, ALIGN_CENTER, scratch, 1.0); // background SCR_DrawFill (icon_x-3, icon_y-3, NUM_SKINBOX_ITEMS*34+4, 38, ALIGN_CENTER, 0,0,0,255); if (R_DrawFindPic("/gfx/ui/listbox_background.pcx")) { x = icon_x-2; y = icon_y-2; w = NUM_SKINBOX_ITEMS*34+2; h = 36; SCR_AdjustFrom640 (&x, &y, &w, &h, ALIGN_CENTER); R_DrawTileClear ((int)x, (int)y, (int)w, (int)h, "/gfx/ui/listbox_background.pcx"); } else SCR_DrawFill (icon_x-2, icon_y-2, NUM_SKINBOX_ITEMS*34+2, 36, ALIGN_CENTER, 60,60,60,255); for (count=0; count<NUM_SKINBOX_ITEMS; i++,count++) { if (i<0 || i>=s_pmi[s_player_model_box.curvalue].nskins) continue; Com_sprintf (scratch, sizeof(scratch), "/players/%s/%s_i.pcx", s_pmi[s_player_model_box.curvalue].directory, s_pmi[s_player_model_box.curvalue].skindisplaynames[i] ); if (i==s_player_skin_box.curvalue) SCR_DrawFill (icon_x + icon_offset-1, icon_y-1, 34, 34, ALIGN_CENTER, color[0],color[1],color[2],255); SCR_DrawPic (icon_x + icon_offset, icon_y, 32, 32, ALIGN_CENTER, scratch, 1.0); icon_offset += 34; } // right arrow icon_offset = NUM_SKINBOX_ITEMS*34; if (s_pmi[s_player_model_box.curvalue].nskins-i>0) Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_right.pcx"); else Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_right_d.pcx"); SCR_DrawPic (icon_x+icon_offset+5, icon_y+2, 32, 32, ALIGN_CENTER, scratch, 1.0); }
void UI_Options_ReloadCrosshairs(void) { if (crosshairs[0]) { int i; for (i = 1; i < numcrosshairs; i++) { crosshairs[i] = R_DrawFindPic(crosshair_names[i]); } } }
/* ============= R_DrawGetPicSize ============= */ void R_DrawGetPicSize (int32_t *w, int32_t *h, char *pic) { image_t *gl; gl = R_DrawFindPic (pic); if (!gl) { *w = *h = -1; return; } R_DrawGetImageSize(w, h, gl); }
/* ============= R_DrawTileClear This repeats a 64*64 tile graphic to fill the screen around a sized down refresh window. ============= */ void R_DrawTileClear (int32_t x, int32_t y, int32_t w, int32_t h, char *pic) { image_t *image; image = R_DrawFindPic (pic); if (!image) { VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic); return; } R_DrawTileImage(x, y, w, h, image); }
/* ============= R_DrawPic ============= */ void R_DrawPic (int32_t x, int32_t y, char *pic) { image_t *gl; gl = R_DrawFindPic (pic); if (!gl) { VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic); return; } R_DrawImage(x, y, gl); }
/* ============= R_DrawScaledPic Psychospaz's code for drawing stretched crosshairs ============= */ void R_DrawScaledPic (int32_t x, int32_t y, float scale, float alpha, char *pic) { image_t *gl; gl = R_DrawFindPic (pic); if (!gl) { VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic); return; } R_DrawScaledImage(x,y,scale,alpha,gl); }
/* ============= R_DrawStretchPic ============= */ void R_DrawStretchPic (int32_t x, int32_t y, int32_t w, int32_t h, char *pic, float alpha) { image_t *gl; gl = R_DrawFindPic (pic); if (!gl) { VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic); return; } R_DrawStretchImage(x, y, w, h, gl, alpha); }
/* ================= CL_RegisterTEntModels ================= */ void CL_RegisterTEntModels (void) { clMedia.mod_explode = R_RegisterModel ("models/objects/explode/tris.md2"); clMedia.mod_smoke = R_RegisterModel ("models/objects/smoke/tris.md2"); clMedia.mod_flash = R_RegisterModel ("models/objects/flash/tris.md2"); clMedia.mod_parasite_segment = R_RegisterModel ("models/monsters/parasite/segment/tris.md2"); clMedia.mod_grapple_cable = R_RegisterModel ("models/ctf/segment/tris.md2"); clMedia.mod_parasite_tip = R_RegisterModel ("models/monsters/parasite/tip/tris.md2"); clMedia.mod_explo = R_RegisterModel ("models/objects/r_explode/tris.md2"); clMedia.mod_bfg_explo = R_RegisterModel ("sprites/s_bfg2.sp2"); clMedia.mod_powerscreen = R_RegisterModel ("models/items/armor/effect/tris.md2"); // Rogue clMedia.mod_explo_big = R_RegisterModel ("models/objects/r_explode2/tris.md2"); clMedia.mod_lightning = R_RegisterModel ("models/proj/lightning/tris.md2"); clMedia.mod_heatbeam = R_RegisterModel ("models/proj/beam/tris.md2"); clMedia.mod_monster_heatbeam = R_RegisterModel ("models/proj/widowbeam/tris.md2"); // new effect models clMedia.mod_shocksplash = R_RegisterModel ("models/objects/shocksplash/tris.md2"); R_RegisterModel ("models/objects/laser/tris.md2"); R_RegisterModel ("models/objects/grenade2/tris.md2"); R_RegisterModel ("models/weapons/v_machn/tris.md2"); R_RegisterModel ("models/weapons/v_handgr/tris.md2"); R_RegisterModel ("models/weapons/v_shotg2/tris.md2"); R_RegisterModel ("models/objects/gibs/bone/tris.md2"); R_RegisterModel ("models/objects/gibs/sm_meat/tris.md2"); R_RegisterModel ("models/objects/gibs/bone2/tris.md2"); // Xatrix // R_RegisterModel ("models/objects/blaser/tris.md2"); R_DrawFindPic ("w_machinegun"); R_DrawFindPic ("a_bullets"); R_DrawFindPic ("i_health"); R_DrawFindPic ("a_grenades"); }
/* ============== SV_Loadgame_f ============== */ void SV_Loadgame_f (void) { char name[MAX_OSPATH]; FILE *f; char *dir; if (Cmd_Argc() != 2) { Com_Printf ("USAGE: loadgame <directory>\n"); return; } Com_Printf ("Loading game...\n"); dir = Cmd_Argv(1); if (strstr (dir, "..") || strstr (dir, "/") || strstr (dir, "\\") ) { Com_Printf ("Bad savedir.\n"); } // make sure the server.ssv file exists Com_sprintf (name, sizeof(name), "%s/save/%s/server.ssv", FS_Gamedir(), Cmd_Argv(1)); f = fopen (name, "rb"); if (!f) { Com_Printf ("No such savegame: %s\n", name); return; } fclose (f); // Knightmare- set saveshot name if ( !dedicated->value && (!strcmp(Cmd_Argv(1), "quick") || !strcmp(Cmd_Argv(1), "quik")) ) { Com_sprintf(sv_loadshotname, sizeof(sv_loadshotname), "save/%s/shot.png", Cmd_Argv(1)); R_FreePic (sv_loadshotname); Com_sprintf(sv_loadshotname, sizeof(sv_loadshotname), "/save/%s/shot.png", Cmd_Argv(1)); load_saveshot = R_DrawFindPic(sv_loadshotname); } SV_CopySaveGame (Cmd_Argv(1), "current"); SV_ReadServerFile (); // go to the map sv.state = ss_dead; // don't save current level when changing SV_Map (false, svs.mapcmd, true); }
/* ============= UI_DrawMainCursor Draws an animating cursor with the point at x,y. The pic will extend to the left of x, and both above and below y. ============= */ void UI_DrawMainCursor (int32_t x, int32_t y, int32_t f) { char cursorname[80]; static qboolean cached; int32_t w,h; if (!cached) { int32_t i; for (i = 0; i < NUM_MAINMENU_CURSOR_FRAMES; i++) { Com_sprintf (cursorname, sizeof(cursorname), "m_cursor%d", i); R_DrawFindPic (cursorname); } cached = true; } Com_sprintf (cursorname, sizeof(cursorname), "m_cursor%d", f); R_DrawGetPicSize (&w, &h, cursorname); SCR_DrawPic (x, y, w, h, ALIGN_CENTER, cursorname, 1.0); }
/* ================ CL_ParseConfigString ================ */ void CL_ParseConfigString (void) { int32_t i; char *s; char olds[MAX_QPATH]; char scratch[1024]; i = MSG_ReadShort (&net_message); if (i < 0 || i >= MAX_CONFIGSTRINGS) Com_Error (ERR_DROP, "configstring > MAX_CONFIGSTRINGS"); s = MSG_ReadString(&net_message); strncpy (olds, cl.configstrings[i], sizeof(olds)); olds[sizeof(olds) - 1] = 0; strcpy (cl.configstrings[i], s); // do something apropriate // Knightmare- 1/2/2002- BIG UGLY HACK for old demos or // connected to server using old protocol // Changed config strings require different parsing if ( LegacyProtocol()) { if (i >= OLD_CS_LIGHTS && i < OLD_CS_LIGHTS+MAX_LIGHTSTYLES) CL_SetLightstyle (i - OLD_CS_LIGHTS); else if (i == CS_CDTRACK) { if (cl.refresh_prepped) CL_PlayBackgroundTrack (); } else if (i >= CS_MODELS && i < CS_MODELS+OLD_MAX_MODELS) { if (cl.refresh_prepped) { cl.model_draw[i-CS_MODELS] = R_RegisterModel (cl.configstrings[i]); if (cl.configstrings[i][0] == '*') cl.model_clip[i-CS_MODELS] = CM_InlineModel (cl.configstrings[i]); else cl.model_clip[i-CS_MODELS] = NULL; } } else if (i >= OLD_CS_SOUNDS && i < OLD_CS_SOUNDS+OLD_MAX_SOUNDS) { if (cl.refresh_prepped) cl.sound_precache[i-OLD_CS_SOUNDS] = S_RegisterSound (cl.configstrings[i]); } else if (i >= OLD_CS_IMAGES && i < OLD_CS_IMAGES+OLD_MAX_IMAGES) { if (cl.refresh_prepped) cl.image_precache[i-OLD_CS_IMAGES] = R_DrawFindPic (cl.configstrings[i]); } else if (i >= OLD_CS_PLAYERSKINS && i < OLD_CS_PLAYERSKINS+MAX_CLIENTS) { if (cl.refresh_prepped && strcmp(olds, s)) CL_ParseClientinfo (i-OLD_CS_PLAYERSKINS); } else if (i >= OLD_CS_ITEMS && i < OLD_CS_ITEMS + MAX_ITEMS) { int j; int item = i - OLD_CS_ITEMS; int32_t token; Com_sprintf (scratch, sizeof(scratch), "use %s", cl.configstrings[i]); token = Q_STLookup(&key_table, scratch); cl.inventorykey[item] = -1; if (token >= 0) { for (j=0; j<MAX_KEYEVENTS; j++) { if (keytokens[j] == token) { cl.inventorykey[item] = j; break; } } } } } else // new configstring offsets { if (i >= CS_LIGHTS && i < CS_LIGHTS+MAX_LIGHTSTYLES) CL_SetLightstyle (i - CS_LIGHTS); else if (i == CS_CDTRACK) { if (cl.refresh_prepped) CL_PlayBackgroundTrack (); } else if (i >= CS_MODELS && i < CS_MODELS+MAX_MODELS) { if (cl.refresh_prepped) { cl.model_draw[i-CS_MODELS] = R_RegisterModel (cl.configstrings[i]); if (cl.configstrings[i][0] == '*') cl.model_clip[i-CS_MODELS] = CM_InlineModel (cl.configstrings[i]); else cl.model_clip[i-CS_MODELS] = NULL; } } else if (i >= CS_SOUNDS && i < CS_SOUNDS+MAX_SOUNDS) //Knightmare- was MAX_MODELS { if (cl.refresh_prepped) cl.sound_precache[i-CS_SOUNDS] = S_RegisterSound (cl.configstrings[i]); } else if (i >= CS_IMAGES && i < CS_IMAGES+MAX_IMAGES) //Knightmare- was MAX_MODELS { if (cl.refresh_prepped) cl.image_precache[i-CS_IMAGES] = R_DrawFindPic (cl.configstrings[i]); } else if (i >= CS_PLAYERSKINS && i < CS_PLAYERSKINS+MAX_CLIENTS) { if (cl.refresh_prepped && strcmp(olds, s)) CL_ParseClientinfo (i-CS_PLAYERSKINS); } else if (i >= CS_ITEMS && i < CS_ITEMS + MAX_ITEMS) { int j; int item = i - CS_ITEMS; int32_t token; Com_sprintf (scratch, sizeof(scratch), "use %s", cl.configstrings[i]); token = Q_STLookup(&key_table, scratch); cl.inventorykey[item] = -1; if (token >= 0) { for (j=0; j<MAX_KEYEVENTS; j++) { if (keytokens[j] == token) { cl.inventorykey[item] = j; break; } } } } } //end Knightmare }
/* ================ CL_LoadClientinfo ================ */ void CL_LoadClientinfo (clientinfo_t *ci, char *s) { int32_t i; char *t; char model_name[MAX_QPATH]; char skin_name[MAX_QPATH]; char model_filename[MAX_QPATH]; char skin_filename[MAX_QPATH]; char weapon_filename[MAX_QPATH]; strncpy(ci->cinfo, s, sizeof(ci->cinfo)); ci->cinfo[sizeof(ci->cinfo)-1] = 0; // isolate the player's name strncpy(ci->name, s, sizeof(ci->name)); ci->name[sizeof(ci->name)-1] = 0; t = strstr (s, "\\"); if (t) { ci->name[t-s] = 0; s = t+1; } if (cl_noskins->value || *s == 0) { Com_sprintf (model_filename, sizeof(model_filename), "players/male/tris.md2"); Com_sprintf (weapon_filename, sizeof(weapon_filename), "players/male/weapon.md2"); Com_sprintf (skin_filename, sizeof(skin_filename), "players/male/grunt.pcx"); Com_sprintf (ci->iconname, sizeof(ci->iconname), "/players/male/grunt_i.pcx"); ci->model = R_RegisterModel (model_filename); memset(ci->weaponmodel, 0, sizeof(ci->weaponmodel)); ci->weaponmodel[0] = R_RegisterModel (weapon_filename); ci->skin = R_RegisterSkin (skin_filename); ci->icon = R_DrawFindPic (ci->iconname); } else { // isolate the model name strcpy (model_name, s); t = strstr(model_name, "/"); if (!t) t = strstr(model_name, "\\"); if (!t) t = model_name; *t = 0; // isolate the skin name strcpy (skin_name, s + strlen(model_name) + 1); // model file Com_sprintf (model_filename, sizeof(model_filename), "players/%s/tris.md2", model_name); ci->model = R_RegisterModel (model_filename); if (!ci->model) { strcpy(model_name, "male"); Com_sprintf (model_filename, sizeof(model_filename), "players/male/tris.md2"); ci->model = R_RegisterModel (model_filename); } // skin file Com_sprintf (skin_filename, sizeof(skin_filename), "players/%s/%s.pcx", model_name, skin_name); ci->skin = R_RegisterSkin (skin_filename); // if we don't have the skin and the model wasn't male, // see if the male has it (this is for CTF's skins) if (!ci->skin && Q_strcasecmp(model_name, "male")) { // change model to male strcpy(model_name, "male"); Com_sprintf (model_filename, sizeof(model_filename), "players/male/tris.md2"); ci->model = R_RegisterModel (model_filename); // see if the skin exists for the male model Com_sprintf (skin_filename, sizeof(skin_filename), "players/%s/%s.pcx", model_name, skin_name); ci->skin = R_RegisterSkin (skin_filename); } // if we still don't have a skin, it means that the male model didn't have // it, so default to grunt if (!ci->skin) { // see if the skin exists for the male model Com_sprintf (skin_filename, sizeof(skin_filename), "players/%s/grunt.pcx", model_name, skin_name); ci->skin = R_RegisterSkin (skin_filename); } // weapon file for (i = 0; i < num_cl_weaponmodels; i++) { Com_sprintf (weapon_filename, sizeof(weapon_filename), "players/%s/%s", model_name, cl_weaponmodels[i]); ci->weaponmodel[i] = R_RegisterModel(weapon_filename); if (!ci->weaponmodel[i] && strcmp(model_name, "cyborg") == 0) { // try male Com_sprintf (weapon_filename, sizeof(weapon_filename), "players/male/%s", cl_weaponmodels[i]); ci->weaponmodel[i] = R_RegisterModel(weapon_filename); } if (!cl_vwep->value) break; // only one when vwep is off } // icon file Com_sprintf (ci->iconname, sizeof(ci->iconname), "/players/%s/%s_i.pcx", model_name, skin_name); ci->icon = R_DrawFindPic (ci->iconname); } // must have loaded all data types to be valud if (!ci->skin || !ci->icon || !ci->model || !ci->weaponmodel[0]) { ci->skin = NULL; ci->icon = NULL; ci->model = NULL; ci->weaponmodel[0] = NULL; return; } }
/* ================= UI_Precache ================= */ void UI_Precache (void) { int i; char scratch[80]; // general images R_DrawFindPic (LOADSCREEN_NAME); R_DrawFindPic (UI_BACKGROUND_NAME); R_DrawFindPic (UI_NOSCREEN_NAME); // loadscreen images R_DrawFindPic ("/pics/loading.pcx"); R_DrawFindPic ("/pics/loading_bar.pcx"); R_DrawFindPic ("/pics/downloading.pcx"); R_DrawFindPic ("/pics/downloading_bar.pcx"); R_DrawFindPic ("/pics/loading_led1.pcx"); // cursors // R_DrawFindPic (UI_MOUSECURSOR_MAIN_PIC); // R_DrawFindPic (UI_MOUSECURSOR_HOVER_PIC); // R_DrawFindPic (UI_MOUSECURSOR_CLICK_PIC); // R_DrawFindPic (UI_MOUSECURSOR_OVER_PIC); // R_DrawFindPic (UI_MOUSECURSOR_TEXT_PIC); R_DrawFindPic (UI_MOUSECURSOR_PIC); for (i = 0; i < NUM_MAINMENU_CURSOR_FRAMES; i++) { Com_sprintf (scratch, sizeof(scratch), "/pics/m_cursor%d.pcx", i); R_DrawFindPic (scratch); } // main menu items R_DrawFindPic ("/pics/m_main_game.pcx"); R_DrawFindPic ("/pics/m_main_game_sel.pcx"); R_DrawFindPic ("/pics/m_main_multiplayer.pcx"); R_DrawFindPic ("/pics/m_main_multiplayer_sel.pcx"); R_DrawFindPic ("/pics/m_main_options.pcx"); R_DrawFindPic ("/pics/m_main_options_sel.pcx"); R_DrawFindPic ("/pics/m_main_video.pcx"); R_DrawFindPic ("/pics/m_main_video_sel.pcx"); // R_DrawFindPic ("/pics/m_main_mods.pcx"); // R_DrawFindPic ("/pics/m_main_mods_sel.pcx"); R_DrawFindPic ("/pics/m_main_quit.pcx"); R_DrawFindPic ("/pics/m_main_quit_sel.pcx"); R_DrawFindPic ("/pics/m_main_plaque.pcx"); R_DrawFindPic ("/pics/m_main_logo.pcx"); R_RegisterModel ("models/ui/quad_cursor.md2"); // menu banners R_DrawFindPic ("/pics/m_banner_game.pcx"); R_DrawFindPic ("/pics/m_banner_load_game.pcx"); R_DrawFindPic ("/pics/m_banner_save_game.pcx"); R_DrawFindPic ("/pics/m_banner_multiplayer.pcx"); R_DrawFindPic ("/pics/m_banner_join_server.pcx"); R_DrawFindPic ("/pics/m_banner_addressbook.pcx"); R_DrawFindPic ("/pics/m_banner_start_server.pcx"); R_DrawFindPic ("/pics/m_banner_plauer_setup.pcx"); // typo for image name is id's fault R_DrawFindPic ("/pics/m_banner_options.pcx"); R_DrawFindPic ("/pics/m_banner_customize.pcx"); R_DrawFindPic ("/pics/m_banner_video.pcx"); // R_DrawFindPic ("/pics/m_banner_mods.pcx"); R_DrawFindPic ("/pics/quit.pcx"); // R_DrawFindPic ("/pics/areyousure.pcx"); // R_DrawFindPic ("/pics/yn.pcx"); // GUI elements R_DrawFindPic ("/gfx/ui/listbox_background.pcx"); R_DrawFindPic ("/gfx/ui/arrows/arrow_left.pcx"); R_DrawFindPic ("/gfx/ui/arrows/arrow_left_d.pcx"); R_DrawFindPic ("/gfx/ui/arrows/arrow_right.pcx"); R_DrawFindPic ("/gfx/ui/arrows/arrow_right_d.pcx"); }
void R_DrawCameraEffect (void) { image_t *image[2]; int32_t x, y, w, h, i, j; float texparms[2][4]; vec2_t texCoord[4]; vec3_t verts[4]; renderparms_t cameraParms; image[0] = R_DrawFindPic ("/gfx/2d/screenstatic.tga"); image[1] = R_DrawFindPic ("/gfx/2d/scanlines.tga"); if (!image[0] || !image[1]) return; x = y = 0; w = vid.width; h = vid.height; GL_Disable (GL_ALPHA_TEST); GL_TexEnv (GL_MODULATE); GL_Enable (GL_BLEND); GL_BlendFunc (GL_DST_COLOR, GL_SRC_COLOR); GL_DepthMask (false); VectorSet(verts[0], x, y, 0); VectorSet(verts[1], x+w, y, 0); VectorSet(verts[2], x+w, y+h, 0); VectorSet(verts[3], x, y+h, 0); Vector4Set(texparms[0], 2, 2, -30, 10); Vector4Set(texparms[1], 1, 10, 0, 0); rb_vertex = rb_index = 0; indexArray[rb_index++] = rb_vertex+0; indexArray[rb_index++] = rb_vertex+1; indexArray[rb_index++] = rb_vertex+2; indexArray[rb_index++] = rb_vertex+0; indexArray[rb_index++] = rb_vertex+2; indexArray[rb_index++] = rb_vertex+3; rb_vertex = 4; for (i=0; i<2; i++) { GL_Bind (image[i]->texnum); Vector2Set(texCoord[0], x/image[i]->width, y/image[i]->height); Vector2Set(texCoord[1], (x+w)/image[i]->width, y/image[i]->height); Vector2Set(texCoord[2], (x+w)/image[i]->width, (y+h)/image[i]->height); Vector2Set(texCoord[3], x/image[i]->width, (y+h)/image[i]->height); Mod_SetRenderParmsDefaults (&cameraParms); cameraParms.scale_x = texparms[i][0]; cameraParms.scale_y = texparms[i][1]; cameraParms.scroll_x = texparms[i][2]; cameraParms.scroll_y = texparms[i][3]; RB_ModifyTextureCoords (&texCoord[0][0], &verts[0][0], 4, cameraParms); for (j=0; j<4; j++) { VA_SetElem2(texCoordArray[0][j], texCoord[j][0], texCoord[j][1]); VA_SetElem3(vertexArray[j], verts[j][0], verts[j][1], verts[j][2]); VA_SetElem4(colorArray[j], 1, 1, 1, 1); } RB_DrawArrays (); } rb_vertex = rb_index = 0; GL_DepthMask (true); GL_BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GL_Disable (GL_BLEND); GL_TexEnv (GL_REPLACE); GL_Enable (GL_ALPHA_TEST); }