Refresh API refactoring

Analog functions of the former refexport_t are now public for the client
to access.
This commit is contained in:
Alejandro Ricoveri 2013-05-01 14:42:38 -04:30 committed by Yamagi Burmeister
parent 6686b875cc
commit 3e45c5e363
17 changed files with 280 additions and 270 deletions

View File

@ -77,7 +77,7 @@ vidmode_t vid_modes[] = {
}; };
/* Structure containing functions exported from refresh DLL */ /* Structure containing functions exported from refresh DLL */
refexport_t re; //refexport_t re;
/* Console variables that we need to access from this module */ /* Console variables that we need to access from this module */
cvar_t *vid_gamma; cvar_t *vid_gamma;
@ -167,7 +167,7 @@ VID_NewWindow(int width, int height)
void void
VID_FreeReflib(void) VID_FreeReflib(void)
{ {
memset(&re, 0, sizeof(re)); //memset(&re, 0, sizeof(re));
} }
qboolean qboolean
@ -205,7 +205,7 @@ VID_LoadRefresh(void)
ri.Vid_NewWindow = VID_NewWindow; ri.Vid_NewWindow = VID_NewWindow;
// Get refresher API exports // Get refresher API exports
re = R_GetRefAPI(ri); R_GetRefAPI(ri);
/* Init IN (Mouse) */ /* Init IN (Mouse) */
in_state.IN_CenterView_fp = IN_CenterView; in_state.IN_CenterView_fp = IN_CenterView;
@ -225,7 +225,8 @@ VID_LoadRefresh(void)
ref_active = true; ref_active = true;
// Initiate the refresher // Initiate the refresher
if (re.Init(0, 0) == -1) //if (re.Init(0, 0) == -1)
if (R_Init(0, 0) == -1)
{ {
VID_Shutdown(); // Isn't that just too bad? :( VID_Shutdown(); // Isn't that just too bad? :(
return false; return false;
@ -286,7 +287,7 @@ VID_Shutdown(void)
IN_BackendShutdown(); IN_BackendShutdown();
/* Shut down the renderer */ /* Shut down the renderer */
re.Shutdown(); R_Shutdown();
// Get rid of refexport function pointers // Get rid of refexport function pointers
// (soon to be deleted) // (soon to be deleted)

View File

@ -168,7 +168,7 @@ SCR_StopCinematic(void)
if (cl.cinematicpalette_active) if (cl.cinematicpalette_active)
{ {
re.CinematicSetPalette(NULL); R_SetPalette(NULL);
cl.cinematicpalette_active = false; cl.cinematicpalette_active = false;
} }
@ -512,14 +512,14 @@ SCR_DrawCinematic(void)
/* blank screen and pause if menu is up */ /* blank screen and pause if menu is up */
if (cls.key_dest == key_menu) if (cls.key_dest == key_menu)
{ {
re.CinematicSetPalette(NULL); R_SetPalette(NULL);
cl.cinematicpalette_active = false; cl.cinematicpalette_active = false;
return true; return true;
} }
if (!cl.cinematicpalette_active) if (!cl.cinematicpalette_active)
{ {
re.CinematicSetPalette(cl.cinematicpalette); R_SetPalette(cl.cinematicpalette);
cl.cinematicpalette_active = true; cl.cinematicpalette_active = true;
} }
@ -549,22 +549,22 @@ SCR_DrawCinematic(void)
if (x > 0) if (x > 0)
{ {
re.DrawFill(0, 0, x, viddef.height, 0); Draw_Fill(0, 0, x, viddef.height, 0);
} }
if (x + w < viddef.width) if (x + w < viddef.width)
{ {
re.DrawFill(x + w, 0, viddef.width - (x + w), viddef.height, 0); Draw_Fill(x + w, 0, viddef.width - (x + w), viddef.height, 0);
} }
if (y > 0) if (y > 0)
{ {
re.DrawFill(x, 0, w, y, 0); Draw_Fill(x, 0, w, y, 0);
} }
if (y + h < viddef.height) if (y + h < viddef.height)
{ {
re.DrawFill(x, y + h, w, viddef.height - (y + h), 0); Draw_Fill(x, y + h, w, viddef.height - (y + h), 0);
} }
re.DrawStretchRaw(x, y, w, h, cin.width, cin.height, cin.pic); Draw_StretchRaw(x, y, w, h, cin.width, cin.height, cin.pic);
return true; return true;
} }

View File

@ -41,7 +41,7 @@ DrawString(int x, int y, char *s)
{ {
while (*s) while (*s)
{ {
re.DrawChar(x, y, *s); Draw_Char(x, y, *s);
x += 8; x += 8;
s++; s++;
} }
@ -52,7 +52,7 @@ DrawAltString(int x, int y, char *s)
{ {
while (*s) while (*s)
{ {
re.DrawChar(x, y, *s ^ 0x80); Draw_Char(x, y, *s ^ 0x80);
x += 8; x += 8;
s++; s++;
} }
@ -493,7 +493,7 @@ Con_DrawInput(void)
for (i = 0; i < con.linewidth; i++) for (i = 0; i < con.linewidth; i++)
{ {
re.DrawChar((i + 1) << 3, con.vislines - 22, text[i]); Draw_Char((i + 1) << 3, con.vislines - 22, text[i]);
} }
/* remove cursor */ /* remove cursor */
@ -540,7 +540,7 @@ Con_DrawNotify(void)
for (x = 0; x < con.linewidth; x++) for (x = 0; x < con.linewidth; x++)
{ {
re.DrawChar((x + 1) << 3, v, text[x]); Draw_Char((x + 1) << 3, v, text[x]);
} }
v += 8; v += 8;
@ -570,11 +570,11 @@ Con_DrawNotify(void)
while (s[x]) while (s[x])
{ {
re.DrawChar((x + skip) << 3, v, s[x]); Draw_Char((x + skip) << 3, v, s[x]);
x++; x++;
} }
re.DrawChar((x + skip) << 3, v, 10 + ((cls.realtime >> 8) & 1)); Draw_Char((x + skip) << 3, v, 10 + ((cls.realtime >> 8) & 1));
v += 8; v += 8;
} }
@ -617,7 +617,7 @@ Con_DrawConsole(float frac)
} }
/* draw the background */ /* draw the background */
re.DrawStretchPic(0, -viddef.height + lines, viddef.width, Draw_StretchPic(0, -viddef.height + lines, viddef.width,
viddef.height, "conback"); viddef.height, "conback");
SCR_AddDirtyPoint(0, 0); SCR_AddDirtyPoint(0, 0);
SCR_AddDirtyPoint(viddef.width - 1, lines - 1); SCR_AddDirtyPoint(viddef.width - 1, lines - 1);
@ -626,7 +626,7 @@ Con_DrawConsole(float frac)
for (x = 0; x < 21; x++) for (x = 0; x < 21; x++)
{ {
re.DrawChar(viddef.width - 173 + x * 8, lines - 35, 128 + version[x]); Draw_Char(viddef.width - 173 + x * 8, lines - 35, 128 + version[x]);
} }
t = time(NULL); t = time(NULL);
@ -637,7 +637,7 @@ Con_DrawConsole(float frac)
for (x = 0; x < 21; x++) for (x = 0; x < 21; x++)
{ {
re.DrawChar(viddef.width - 173 + x * 8, lines - 25, 128 + tmpbuf[x]); Draw_Char(viddef.width - 173 + x * 8, lines - 25, 128 + tmpbuf[x]);
} }
/* draw the text */ /* draw the text */
@ -653,7 +653,7 @@ Con_DrawConsole(float frac)
/* draw arrows to show the buffer is backscrolled */ /* draw arrows to show the buffer is backscrolled */
for (x = 0; x < con.linewidth; x += 4) for (x = 0; x < con.linewidth; x += 4)
{ {
re.DrawChar((x + 1) << 3, y, '^'); Draw_Char((x + 1) << 3, y, '^');
} }
y -= 8; y -= 8;
@ -678,7 +678,7 @@ Con_DrawConsole(float frac)
for (x = 0; x < con.linewidth; x++) for (x = 0; x < con.linewidth; x++)
{ {
re.DrawChar((x + 1) << 3, y, text[x]); Draw_Char((x + 1) << 3, y, text[x]);
} }
} }
@ -749,7 +749,7 @@ Con_DrawConsole(float frac)
for (i = 0; i < strlen(dlbar); i++) for (i = 0; i < strlen(dlbar); i++)
{ {
re.DrawChar((i + 1) << 3, y, dlbar[i]); Draw_Char((i + 1) << 3, y, dlbar[i]);
} }
} }

View File

@ -67,26 +67,26 @@ S_RegisterSexedModel(entity_state_t *ent, char *base)
} }
Com_sprintf(buffer, sizeof(buffer), "players/%s/%s", model, base + 1); Com_sprintf(buffer, sizeof(buffer), "players/%s/%s", model, base + 1);
md2 = re.RegisterModel(buffer); md2 = R_RegisterModel(buffer);
if (!md2) if (!md2)
{ {
/* not found, try default weapon model */ /* not found, try default weapon model */
Com_sprintf(buffer, sizeof(buffer), "players/%s/weapon.md2", model); Com_sprintf(buffer, sizeof(buffer), "players/%s/weapon.md2", model);
md2 = re.RegisterModel(buffer); md2 = R_RegisterModel(buffer);
if (!md2) if (!md2)
{ {
/* no, revert to the male model */ /* no, revert to the male model */
Com_sprintf(buffer, sizeof(buffer), "players/%s/%s", Com_sprintf(buffer, sizeof(buffer), "players/%s/%s",
"male", base + 1); "male", base + 1);
md2 = re.RegisterModel(buffer); md2 = R_RegisterModel(buffer);
if (!md2) if (!md2)
{ {
/* last try, default male weapon.md2 */ /* last try, default male weapon.md2 */
Com_sprintf(buffer, sizeof(buffer), "players/male/weapon.md2"); Com_sprintf(buffer, sizeof(buffer), "players/male/weapon.md2");
md2 = re.RegisterModel(buffer); md2 = R_RegisterModel(buffer);
} }
} }
} }
@ -231,18 +231,18 @@ CL_AddPacketEntities(frame_t *frame)
{ {
if (!strncmp((char *)ent.skin, "players/male", 12)) if (!strncmp((char *)ent.skin, "players/male", 12))
{ {
ent.skin = re.RegisterSkin("players/male/disguise.pcx"); ent.skin = R_RegisterSkin("players/male/disguise.pcx");
ent.model = re.RegisterModel("players/male/tris.md2"); ent.model = R_RegisterModel("players/male/tris.md2");
} }
else if (!strncmp((char *)ent.skin, "players/female", 14)) else if (!strncmp((char *)ent.skin, "players/female", 14))
{ {
ent.skin = re.RegisterSkin("players/female/disguise.pcx"); ent.skin = R_RegisterSkin("players/female/disguise.pcx");
ent.model = re.RegisterModel("players/female/tris.md2"); ent.model = R_RegisterModel("players/female/tris.md2");
} }
else if (!strncmp((char *)ent.skin, "players/cyborg", 14)) else if (!strncmp((char *)ent.skin, "players/cyborg", 14))
{ {
ent.skin = re.RegisterSkin("players/cyborg/disguise.pcx"); ent.skin = R_RegisterSkin("players/cyborg/disguise.pcx");
ent.model = re.RegisterModel("players/cyborg/tris.md2"); ent.model = R_RegisterModel("players/cyborg/tris.md2");
} }
} }
} }
@ -404,11 +404,11 @@ CL_AddPacketEntities(frame_t *frame)
renderfx |= RF_SHELL_BLUE; renderfx |= RF_SHELL_BLUE;
} }
/* if we have a blue shell (and not a red shell), /* if we have a blue shell (and not a red shell),
turn it to cyan by adding green */ turn it to cyan by adding green */
else if (renderfx & RF_SHELL_BLUE) else if (renderfx & RF_SHELL_BLUE)
{ {
/* go to green if it's on already, /* go to green if it's on already,
otherwise do cyan (flash green) */ otherwise do cyan (flash green) */
if (renderfx & RF_SHELL_GREEN) if (renderfx & RF_SHELL_GREEN)
{ {

View File

@ -42,7 +42,7 @@ Inv_DrawString(int x, int y, char *string)
{ {
while (*string) while (*string)
{ {
re.DrawChar(x, y, *string); Draw_Char(x, y, *string);
x += 8; x += 8;
string++; string++;
} }
@ -110,7 +110,7 @@ CL_DrawInventory(void)
/* repaint everything next frame */ /* repaint everything next frame */
SCR_DirtyScreen(); SCR_DirtyScreen();
re.DrawPic(x, y + 8, "inventory"); Draw_Pic(x, y + 8, "inventory");
y += 24; y += 24;
x += 24; x += 24;
@ -149,7 +149,7 @@ CL_DrawInventory(void)
/* draw a blinky cursor by the selected item */ /* draw a blinky cursor by the selected item */
if ((int)(cls.realtime * 10) & 1) if ((int)(cls.realtime * 10) & 1)
{ {
re.DrawChar(x - 8, y, 15); Draw_Char(x - 8, y, 15);
} }
} }

View File

@ -198,7 +198,7 @@ CL_Connect_f(void)
if (Com_ServerState()) if (Com_ServerState())
{ {
/* if running a local server, kill it and reissue /* if running a local server, kill it and reissue
note: this is connect with the save game system */ note: this is connect with the save game system */
SV_Shutdown(va("Server quit\n", msg), false); SV_Shutdown(va("Server quit\n", msg), false);
} }
@ -285,7 +285,7 @@ CL_Rcon_f(void)
} }
/* /*
* Goes from a connected state to full screen * Goes from a connected state to full screen
* console state Sends a disconnect message to * console state Sends a disconnect message to
* the server This is also called on Com_Error, so * the server This is also called on Com_Error, so
* it shouldn't cause any errors * it shouldn't cause any errors
@ -316,7 +316,7 @@ CL_Disconnect(void)
VectorClear(cl.refdef.blend); VectorClear(cl.refdef.blend);
re.CinematicSetPalette(NULL); R_SetPalette(NULL);
M_ForceMenuOff(); M_ForceMenuOff();

View File

@ -803,7 +803,7 @@ CL_ParseFrame(void)
CL_FireEntityEvents(&cl.frame); CL_FireEntityEvents(&cl.frame);
if (!(!cl_predict->value || if (!(!cl_predict->value ||
(cl.frame.playerstate.pmove.pm_flags & (cl.frame.playerstate.pmove.pm_flags &
PMF_NO_PREDICTION))) PMF_NO_PREDICTION)))
{ {
CL_CheckPredictionError(); CL_CheckPredictionError();
@ -920,11 +920,11 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
strcpy(weapon_filename, "players/male/weapon.md2"); strcpy(weapon_filename, "players/male/weapon.md2");
strcpy(skin_filename, "players/male/grunt.pcx"); strcpy(skin_filename, "players/male/grunt.pcx");
strcpy(ci->iconname, "/players/male/grunt_i.pcx"); strcpy(ci->iconname, "/players/male/grunt_i.pcx");
ci->model = re.RegisterModel(model_filename); ci->model = R_RegisterModel(model_filename);
memset(ci->weaponmodel, 0, sizeof(ci->weaponmodel)); memset(ci->weaponmodel, 0, sizeof(ci->weaponmodel));
ci->weaponmodel[0] = re.RegisterModel(weapon_filename); ci->weaponmodel[0] = R_RegisterModel(weapon_filename);
ci->skin = re.RegisterSkin(skin_filename); ci->skin = R_RegisterSkin(skin_filename);
ci->icon = re.RegisterPic(ci->iconname); ci->icon = Draw_FindPic(ci->iconname);
} }
else else
{ {
@ -950,20 +950,20 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
/* model file */ /* model file */
Com_sprintf(model_filename, sizeof(model_filename), Com_sprintf(model_filename, sizeof(model_filename),
"players/%s/tris.md2", model_name); "players/%s/tris.md2", model_name);
ci->model = re.RegisterModel(model_filename); ci->model = R_RegisterModel(model_filename);
if (!ci->model) if (!ci->model)
{ {
strcpy(model_name, "male"); strcpy(model_name, "male");
Com_sprintf(model_filename, sizeof(model_filename), Com_sprintf(model_filename, sizeof(model_filename),
"players/male/tris.md2"); "players/male/tris.md2");
ci->model = re.RegisterModel(model_filename); ci->model = R_RegisterModel(model_filename);
} }
/* skin file */ /* skin file */
Com_sprintf(skin_filename, sizeof(skin_filename), Com_sprintf(skin_filename, sizeof(skin_filename),
"players/%s/%s.pcx", model_name, skin_name); "players/%s/%s.pcx", model_name, skin_name);
ci->skin = re.RegisterSkin(skin_filename); ci->skin = R_RegisterSkin(skin_filename);
/* if we don't have the skin and the model wasn't male, /* 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) */ * see if the male has it (this is for CTF's skins) */
@ -973,12 +973,12 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
strcpy(model_name, "male"); strcpy(model_name, "male");
Com_sprintf(model_filename, sizeof(model_filename), Com_sprintf(model_filename, sizeof(model_filename),
"players/male/tris.md2"); "players/male/tris.md2");
ci->model = re.RegisterModel(model_filename); ci->model = R_RegisterModel(model_filename);
/* see if the skin exists for the male model */ /* see if the skin exists for the male model */
Com_sprintf(skin_filename, sizeof(skin_filename), Com_sprintf(skin_filename, sizeof(skin_filename),
"players/%s/%s.pcx", model_name, skin_name); "players/%s/%s.pcx", model_name, skin_name);
ci->skin = re.RegisterSkin(skin_filename); ci->skin = R_RegisterSkin(skin_filename);
} }
/* if we still don't have a skin, it means that the male model didn't have /* if we still don't have a skin, it means that the male model didn't have
@ -988,7 +988,7 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
/* see if the skin exists for the male model */ /* see if the skin exists for the male model */
Com_sprintf(skin_filename, sizeof(skin_filename), Com_sprintf(skin_filename, sizeof(skin_filename),
"players/%s/grunt.pcx", model_name, skin_name); "players/%s/grunt.pcx", model_name, skin_name);
ci->skin = re.RegisterSkin(skin_filename); ci->skin = R_RegisterSkin(skin_filename);
} }
/* weapon file */ /* weapon file */
@ -996,14 +996,14 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
{ {
Com_sprintf(weapon_filename, sizeof(weapon_filename), Com_sprintf(weapon_filename, sizeof(weapon_filename),
"players/%s/%s", model_name, cl_weaponmodels[i]); "players/%s/%s", model_name, cl_weaponmodels[i]);
ci->weaponmodel[i] = re.RegisterModel(weapon_filename); ci->weaponmodel[i] = R_RegisterModel(weapon_filename);
if (!ci->weaponmodel[i] && (strcmp(model_name, "cyborg") == 0)) if (!ci->weaponmodel[i] && (strcmp(model_name, "cyborg") == 0))
{ {
/* try male */ /* try male */
Com_sprintf(weapon_filename, sizeof(weapon_filename), Com_sprintf(weapon_filename, sizeof(weapon_filename),
"players/male/%s", cl_weaponmodels[i]); "players/male/%s", cl_weaponmodels[i]);
ci->weaponmodel[i] = re.RegisterModel(weapon_filename); ci->weaponmodel[i] = R_RegisterModel(weapon_filename);
} }
if (!cl_vwep->value) if (!cl_vwep->value)
@ -1015,7 +1015,7 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
/* icon file */ /* icon file */
Com_sprintf(ci->iconname, sizeof(ci->iconname), Com_sprintf(ci->iconname, sizeof(ci->iconname),
"/players/%s/%s_i.pcx", model_name, skin_name); "/players/%s/%s_i.pcx", model_name, skin_name);
ci->icon = re.RegisterPic(ci->iconname); ci->icon = Draw_FindPic(ci->iconname);
} }
/* must have loaded all data types to be valid */ /* must have loaded all data types to be valid */
@ -1100,7 +1100,7 @@ CL_ParseConfigString(void)
{ {
if (cl.refresh_prepped) if (cl.refresh_prepped)
{ {
cl.model_draw[i - CS_MODELS] = re.RegisterModel(cl.configstrings[i]); cl.model_draw[i - CS_MODELS] = R_RegisterModel(cl.configstrings[i]);
if (cl.configstrings[i][0] == '*') if (cl.configstrings[i][0] == '*')
{ {
@ -1117,7 +1117,7 @@ CL_ParseConfigString(void)
{ {
if (cl.refresh_prepped) if (cl.refresh_prepped)
{ {
cl.sound_precache[i - CS_SOUNDS] = cl.sound_precache[i - CS_SOUNDS] =
S_RegisterSound(cl.configstrings[i]); S_RegisterSound(cl.configstrings[i]);
} }
} }
@ -1125,7 +1125,7 @@ CL_ParseConfigString(void)
{ {
if (cl.refresh_prepped) if (cl.refresh_prepped)
{ {
cl.image_precache[i - CS_IMAGES] = re.RegisterPic(cl.configstrings[i]); cl.image_precache[i - CS_IMAGES] = Draw_FindPic(cl.configstrings[i]);
} }
} }
else if ((i >= CS_PLAYERSKINS) && (i < CS_PLAYERSKINS + MAX_CLIENTS)) else if ((i >= CS_PLAYERSKINS) && (i < CS_PLAYERSKINS + MAX_CLIENTS))
@ -1387,7 +1387,7 @@ CL_ParseServerMessage(void)
CL_AddNetgraph(); CL_AddNetgraph();
/* we don't know if it is ok to save a demo message /* we don't know if it is ok to save a demo message
until after we have parsed the frame */ until after we have parsed the frame */
if (cls.demorecording && !cls.demowaiting) if (cls.demorecording && !cls.demowaiting)
{ {

View File

@ -135,7 +135,7 @@ SCR_DrawDebugGraph(void)
x = scr_vrect.x; x = scr_vrect.x;
y = scr_vrect.y + scr_vrect.height; y = scr_vrect.y + scr_vrect.height;
re.DrawFill(x, y - scr_graphheight->value, Draw_Fill(x, y - scr_graphheight->value,
w, scr_graphheight->value, 8); w, scr_graphheight->value, 8);
for (a = 0; a < w; a++) for (a = 0; a < w; a++)
@ -152,7 +152,7 @@ SCR_DrawDebugGraph(void)
} }
h = (int)v % (int)scr_graphheight->value; h = (int)v % (int)scr_graphheight->value;
re.DrawFill(x + w - 1 - a, y - h, 1, h, color); Draw_Fill(x + w - 1 - a, y - h, 1, h, color);
} }
} }
@ -281,7 +281,7 @@ SCR_DrawCenterString(void)
for (j = 0; j < l; j++, x += 8) for (j = 0; j < l; j++, x += 8)
{ {
re.DrawChar(x, y, start[j]); Draw_Char(x, y, start[j]);
if (!remaining--) if (!remaining--)
{ {
@ -408,7 +408,7 @@ SCR_Sky_f(void)
axis[2] = 1; axis[2] = 1;
} }
re.SetSky(Cmd_Argv(1), rotate, axis); R_SetSky(Cmd_Argv(1), rotate, axis);
} }
void void
@ -445,7 +445,7 @@ SCR_DrawNet(void)
return; return;
} }
re.DrawPic(scr_vrect.x + 64, scr_vrect.y, "net"); Draw_Pic(scr_vrect.x + 64, scr_vrect.y, "net");
} }
void void
@ -463,8 +463,8 @@ SCR_DrawPause(void)
return; return;
} }
re.DrawGetPicSize(&w, &h, "pause"); Draw_GetPicSize(&w, &h, "pause");
re.DrawPic((viddef.width - w) / 2, viddef.height / 2 + 8, "pause"); Draw_Pic((viddef.width - w) / 2, viddef.height / 2 + 8, "pause");
} }
void void
@ -478,8 +478,8 @@ SCR_DrawLoading(void)
} }
scr_draw_loading = false; scr_draw_loading = false;
re.DrawGetPicSize(&w, &h, "loading"); Draw_GetPicSize(&w, &h, "loading");
re.DrawPic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading"); Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading");
} }
/* /*
@ -534,7 +534,7 @@ SCR_DrawConsole(void)
{ {
/* connected, but can't render */ /* connected, but can't render */
Con_DrawConsole(0.5); Con_DrawConsole(0.5);
re.DrawFill(0, viddef.height / 2, viddef.width, viddef.height / 2, 0); Draw_Fill(0, viddef.height / 2, viddef.width, viddef.height / 2, 0);
return; return;
} }
@ -647,15 +647,15 @@ SCR_TimeRefresh_f(void)
for (j = 0; j < 1000; j++) for (j = 0; j < 1000; j++)
{ {
re.BeginFrame(0); R_BeginFrame(0);
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
{ {
cl.refdef.viewangles[1] = i / 128.0f * 360.0f; cl.refdef.viewangles[1] = i / 128.0f * 360.0f;
re.RenderFrame(&cl.refdef); R_RenderFrame(&cl.refdef);
} }
re.EndFrame(); GLimp_EndFrame();
} }
} }
else else
@ -664,9 +664,9 @@ SCR_TimeRefresh_f(void)
{ {
cl.refdef.viewangles[1] = i / 128.0f * 360.0f; cl.refdef.viewangles[1] = i / 128.0f * 360.0f;
re.BeginFrame(0); R_BeginFrame(0);
re.RenderFrame(&cl.refdef); R_RenderFrame(&cl.refdef);
re.EndFrame(); GLimp_EndFrame();
} }
} }
@ -788,7 +788,7 @@ SCR_TileClear(void)
{ {
/* clear above view screen */ /* clear above view screen */
i = clear.y2 < top - 1 ? clear.y2 : top - 1; i = clear.y2 < top - 1 ? clear.y2 : top - 1;
re.DrawTileClear(clear.x1, clear.y1, Draw_TileClear(clear.x1, clear.y1,
clear.x2 - clear.x1 + 1, i - clear.y1 + 1, "backtile"); clear.x2 - clear.x1 + 1, i - clear.y1 + 1, "backtile");
clear.y1 = top; clear.y1 = top;
} }
@ -797,7 +797,7 @@ SCR_TileClear(void)
{ {
/* clear below view screen */ /* clear below view screen */
i = clear.y1 > bottom + 1 ? clear.y1 : bottom + 1; i = clear.y1 > bottom + 1 ? clear.y1 : bottom + 1;
re.DrawTileClear(clear.x1, i, Draw_TileClear(clear.x1, i,
clear.x2 - clear.x1 + 1, clear.y2 - i + 1, "backtile"); clear.x2 - clear.x1 + 1, clear.y2 - i + 1, "backtile");
clear.y2 = bottom; clear.y2 = bottom;
} }
@ -806,7 +806,7 @@ SCR_TileClear(void)
{ {
/* clear left of view screen */ /* clear left of view screen */
i = clear.x2 < left - 1 ? clear.x2 : left - 1; i = clear.x2 < left - 1 ? clear.x2 : left - 1;
re.DrawTileClear(clear.x1, clear.y1, Draw_TileClear(clear.x1, clear.y1,
i - clear.x1 + 1, clear.y2 - clear.y1 + 1, "backtile"); i - clear.x1 + 1, clear.y2 - clear.y1 + 1, "backtile");
clear.x1 = left; clear.x1 = left;
} }
@ -815,7 +815,7 @@ SCR_TileClear(void)
{ {
/* clear left of view screen */ /* clear left of view screen */
i = clear.x1 > right + 1 ? clear.x1 : right + 1; i = clear.x1 > right + 1 ? clear.x1 : right + 1;
re.DrawTileClear(i, clear.y1, Draw_TileClear(i, clear.y1,
clear.x2 - i + 1, clear.y2 - clear.y1 + 1, "backtile"); clear.x2 - i + 1, clear.y2 - clear.y1 + 1, "backtile");
clear.x2 = right; clear.x2 = right;
} }
@ -909,7 +909,7 @@ DrawHUDString(char *string, int x, int y, int centerwidth, int xor)
for (i = 0; i < width; i++) for (i = 0; i < width; i++)
{ {
re.DrawChar(x, y, line[i] ^ xor); Draw_Char(x, y, line[i] ^ xor);
x += 8; x += 8;
} }
@ -966,7 +966,7 @@ SCR_DrawField(int x, int y, int color, int width, int value)
frame = *ptr - '0'; frame = *ptr - '0';
} }
re.DrawPic(x, y, sb_nums[color][frame]); Draw_Pic(x, y, sb_nums[color][frame]);
x += CHAR_WIDTH; x += CHAR_WIDTH;
ptr++; ptr++;
l--; l--;
@ -985,7 +985,7 @@ SCR_TouchPics(void)
{ {
for (j = 0; j < 11; j++) for (j = 0; j < 11; j++)
{ {
re.RegisterPic(sb_nums[i][j]); Draw_FindPic(sb_nums[i][j]);
} }
} }
@ -998,7 +998,7 @@ SCR_TouchPics(void)
Com_sprintf(crosshair_pic, sizeof(crosshair_pic), "ch%i", Com_sprintf(crosshair_pic, sizeof(crosshair_pic), "ch%i",
(int)(crosshair->value)); (int)(crosshair->value));
re.DrawGetPicSize(&crosshair_width, &crosshair_height, crosshair_pic); Draw_GetPicSize(&crosshair_width, &crosshair_height, crosshair_pic);
if (!crosshair_width) if (!crosshair_width)
{ {
@ -1098,7 +1098,7 @@ SCR_ExecuteLayoutString(char *s)
{ {
SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x, y);
SCR_AddDirtyPoint(x + 23, y + 23); SCR_AddDirtyPoint(x + 23, y + 23);
re.DrawPic(x, y, cl.configstrings[CS_IMAGES + value]); Draw_Pic(x, y, cl.configstrings[CS_IMAGES + value]);
} }
continue; continue;
@ -1146,7 +1146,7 @@ SCR_ExecuteLayoutString(char *s)
ci = &cl.baseclientinfo; ci = &cl.baseclientinfo;
} }
re.DrawPic(x, y, ci->iconname); Draw_Pic(x, y, ci->iconname);
continue; continue;
} }
@ -1205,7 +1205,7 @@ SCR_ExecuteLayoutString(char *s)
token = COM_Parse(&s); token = COM_Parse(&s);
SCR_AddDirtyPoint(x, y); SCR_AddDirtyPoint(x, y);
SCR_AddDirtyPoint(x + 23, y + 23); SCR_AddDirtyPoint(x + 23, y + 23);
re.DrawPic(x, y, (char *)token); Draw_Pic(x, y, (char *)token);
continue; continue;
} }
@ -1243,7 +1243,7 @@ SCR_ExecuteLayoutString(char *s)
if (cl.frame.playerstate.stats[STAT_FLASHES] & 1) if (cl.frame.playerstate.stats[STAT_FLASHES] & 1)
{ {
re.DrawPic(x, y, "field_3"); Draw_Pic(x, y, "field_3");
} }
SCR_DrawField(x, y, color, width, value); SCR_DrawField(x, y, color, width, value);
@ -1273,7 +1273,7 @@ SCR_ExecuteLayoutString(char *s)
if (cl.frame.playerstate.stats[STAT_FLASHES] & 4) if (cl.frame.playerstate.stats[STAT_FLASHES] & 4)
{ {
re.DrawPic(x, y, "field_3"); Draw_Pic(x, y, "field_3");
} }
SCR_DrawField(x, y, color, width, value); SCR_DrawField(x, y, color, width, value);
@ -1297,7 +1297,7 @@ SCR_ExecuteLayoutString(char *s)
if (cl.frame.playerstate.stats[STAT_FLASHES] & 2) if (cl.frame.playerstate.stats[STAT_FLASHES] & 2)
{ {
re.DrawPic(x, y, "field_3"); Draw_Pic(x, y, "field_3");
} }
SCR_DrawField(x, y, color, width, value); SCR_DrawField(x, y, color, width, value);
@ -1397,7 +1397,7 @@ SCR_DrawLayout(void)
} }
/* /*
* This is called every frame, and can also be called * This is called every frame, and can also be called
* explicitly to flush text to the screen. * explicitly to flush text to the screen.
*/ */
void void
@ -1407,7 +1407,7 @@ SCR_UpdateScreen(void)
int i; int i;
float separation[2] = {0, 0}; float separation[2] = {0, 0};
/* if the screen is disabled (loading plaque is /* if the screen is disabled (loading plaque is
up, or vid mode changing) do nothing at all */ up, or vid mode changing) do nothing at all */
if (cls.disable_screen) if (cls.disable_screen)
{ {
@ -1431,17 +1431,17 @@ SCR_UpdateScreen(void)
for (i = 0; i < numframes; i++) for (i = 0; i < numframes; i++)
{ {
re.BeginFrame(separation[i]); R_BeginFrame(separation[i]);
if (scr_draw_loading == 2) if (scr_draw_loading == 2)
{ {
/* loading plaque over black screen */ /* loading plaque over black screen */
int w, h; int w, h;
re.CinematicSetPalette(NULL); R_SetPalette(NULL);
scr_draw_loading = false; scr_draw_loading = false;
re.DrawGetPicSize(&w, &h, "loading"); Draw_GetPicSize(&w, &h, "loading");
re.DrawPic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading"); Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading");
} }
/* if a cinematic is supposed to be running, /* if a cinematic is supposed to be running,
@ -1452,7 +1452,7 @@ SCR_UpdateScreen(void)
{ {
if (cl.cinematicpalette_active) if (cl.cinematicpalette_active)
{ {
re.CinematicSetPalette(NULL); R_SetPalette(NULL);
cl.cinematicpalette_active = false; cl.cinematicpalette_active = false;
} }
@ -1462,7 +1462,7 @@ SCR_UpdateScreen(void)
{ {
if (cl.cinematicpalette_active) if (cl.cinematicpalette_active)
{ {
re.CinematicSetPalette(NULL); R_SetPalette(NULL);
cl.cinematicpalette_active = false; cl.cinematicpalette_active = false;
} }
@ -1478,7 +1478,7 @@ SCR_UpdateScreen(void)
/* make sure the game palette is active */ /* make sure the game palette is active */
if (cl.cinematicpalette_active) if (cl.cinematicpalette_active)
{ {
re.CinematicSetPalette(NULL); R_SetPalette(NULL);
cl.cinematicpalette_active = false; cl.cinematicpalette_active = false;
} }
@ -1533,7 +1533,7 @@ SCR_UpdateScreen(void)
} }
} }
re.EndFrame(); GLimp_EndFrame();
} }
void void
@ -1570,7 +1570,7 @@ SCR_DrawCrosshair(void)
return; return;
} }
re.DrawPic(scr_vrect.x + ((scr_vrect.width - crosshair_width) >> 1), Draw_Pic(scr_vrect.x + ((scr_vrect.width - crosshair_width) >> 1),
scr_vrect.y + ((scr_vrect.height - crosshair_height) >> 1), scr_vrect.y + ((scr_vrect.height - crosshair_height) >> 1),
crosshair_pic); crosshair_pic);
} }

View File

@ -149,34 +149,34 @@ CL_RegisterTEntSounds(void)
void void
CL_RegisterTEntModels(void) CL_RegisterTEntModels(void)
{ {
cl_mod_explode = re.RegisterModel("models/objects/explode/tris.md2"); cl_mod_explode = R_RegisterModel("models/objects/explode/tris.md2");
cl_mod_smoke = re.RegisterModel("models/objects/smoke/tris.md2"); cl_mod_smoke = R_RegisterModel("models/objects/smoke/tris.md2");
cl_mod_flash = re.RegisterModel("models/objects/flash/tris.md2"); cl_mod_flash = R_RegisterModel("models/objects/flash/tris.md2");
cl_mod_parasite_segment = re.RegisterModel("models/monsters/parasite/segment/tris.md2"); cl_mod_parasite_segment = R_RegisterModel("models/monsters/parasite/segment/tris.md2");
cl_mod_grapple_cable = re.RegisterModel("models/ctf/segment/tris.md2"); cl_mod_grapple_cable = R_RegisterModel("models/ctf/segment/tris.md2");
cl_mod_parasite_tip = re.RegisterModel("models/monsters/parasite/tip/tris.md2"); cl_mod_parasite_tip = R_RegisterModel("models/monsters/parasite/tip/tris.md2");
cl_mod_explo4 = re.RegisterModel("models/objects/r_explode/tris.md2"); cl_mod_explo4 = R_RegisterModel("models/objects/r_explode/tris.md2");
cl_mod_bfg_explo = re.RegisterModel("sprites/s_bfg2.sp2"); cl_mod_bfg_explo = R_RegisterModel("sprites/s_bfg2.sp2");
cl_mod_powerscreen = re.RegisterModel("models/items/armor/effect/tris.md2"); cl_mod_powerscreen = R_RegisterModel("models/items/armor/effect/tris.md2");
re.RegisterModel("models/objects/laser/tris.md2"); R_RegisterModel("models/objects/laser/tris.md2");
re.RegisterModel("models/objects/grenade2/tris.md2"); R_RegisterModel("models/objects/grenade2/tris.md2");
re.RegisterModel("models/weapons/v_machn/tris.md2"); R_RegisterModel("models/weapons/v_machn/tris.md2");
re.RegisterModel("models/weapons/v_handgr/tris.md2"); R_RegisterModel("models/weapons/v_handgr/tris.md2");
re.RegisterModel("models/weapons/v_shotg2/tris.md2"); R_RegisterModel("models/weapons/v_shotg2/tris.md2");
re.RegisterModel("models/objects/gibs/bone/tris.md2"); R_RegisterModel("models/objects/gibs/bone/tris.md2");
re.RegisterModel("models/objects/gibs/sm_meat/tris.md2"); R_RegisterModel("models/objects/gibs/sm_meat/tris.md2");
re.RegisterModel("models/objects/gibs/bone2/tris.md2"); R_RegisterModel("models/objects/gibs/bone2/tris.md2");
re.RegisterPic("w_machinegun"); Draw_FindPic("w_machinegun");
re.RegisterPic("a_bullets"); Draw_FindPic("a_bullets");
re.RegisterPic("i_health"); Draw_FindPic("i_health");
re.RegisterPic("a_grenades"); Draw_FindPic("a_grenades");
cl_mod_explo4_big = re.RegisterModel("models/objects/r_explode2/tris.md2"); cl_mod_explo4_big = R_RegisterModel("models/objects/r_explode2/tris.md2");
cl_mod_lightning = re.RegisterModel("models/proj/lightning/tris.md2"); cl_mod_lightning = R_RegisterModel("models/proj/lightning/tris.md2");
cl_mod_heatbeam = re.RegisterModel("models/proj/beam/tris.md2"); cl_mod_heatbeam = R_RegisterModel("models/proj/beam/tris.md2");
cl_mod_monster_heatbeam = re.RegisterModel("models/proj/widowbeam/tris.md2"); cl_mod_monster_heatbeam = R_RegisterModel("models/proj/widowbeam/tris.md2");
} }
void void
@ -412,7 +412,7 @@ CL_ParsePlayerBeam(struct model_s *model)
{ {
b->entity = ent; b->entity = ent;
b->model = model; b->model = model;
b->endtime = cl.time + 100; /* this needs to be 100 to b->endtime = cl.time + 100; /* this needs to be 100 to
prevent multiple heatbeams */ prevent multiple heatbeams */
VectorCopy(start, b->start); VectorCopy(start, b->start);
VectorCopy(end, b->end); VectorCopy(end, b->end);
@ -1335,10 +1335,10 @@ CL_AddBeams(void)
steps = (float)ceil(d / model_length); steps = (float)ceil(d / model_length);
len = (d - model_length) / (steps - 1); len = (d - model_length) / (steps - 1);
/* special case for lightning model .. if the real length /* special case for lightning model .. if the real length
is shorter than the model, flip it around & draw it is shorter than the model, flip it around & draw it
from the end to the start. This prevents the model from from the end to the start. This prevents the model from
going through the tesla mine (instead it goes through going through the tesla mine (instead it goes through
the target) */ the target) */
if ((b->model == cl_mod_lightning) && (d <= model_length)) if ((b->model == cl_mod_lightning) && (d <= model_length))
{ {
@ -1614,10 +1614,10 @@ CL_AddPlayerBeams(void)
steps = ceil(d / model_length); steps = ceil(d / model_length);
len = (d - model_length) / (steps - 1); len = (d - model_length) / (steps - 1);
/* special case for lightning model .. if the real /* special case for lightning model .. if the real
length is shorter than the model, flip it around length is shorter than the model, flip it around
& draw it from the end to the start. This prevents & draw it from the end to the start. This prevents
the model from going through the tesla mine the model from going through the tesla mine
(instead it goes through the target) */ (instead it goes through the target) */
if ((b->model == cl_mod_lightning) && (d <= model_length)) if ((b->model == cl_mod_lightning) && (d <= model_length))
{ {

View File

@ -291,7 +291,7 @@ CL_PrepRefresh(void)
} }
else else
{ {
cl.model_draw[i] = re.RegisterModel(cl.configstrings[CS_MODELS + i]); cl.model_draw[i] = R_RegisterModel(cl.configstrings[CS_MODELS + i]);
if (name[0] == '*') if (name[0] == '*')
{ {
@ -315,7 +315,7 @@ CL_PrepRefresh(void)
for (i = 1; i < MAX_IMAGES && cl.configstrings[CS_IMAGES + i][0]; i++) for (i = 1; i < MAX_IMAGES && cl.configstrings[CS_IMAGES + i][0]; i++)
{ {
cl.image_precache[i] = re.RegisterPic(cl.configstrings[CS_IMAGES + i]); cl.image_precache[i] = Draw_FindPic(cl.configstrings[CS_IMAGES + i]);
Sys_SendKeyEvents(); Sys_SendKeyEvents();
} }
@ -342,11 +342,11 @@ CL_PrepRefresh(void)
SCR_UpdateScreen(); SCR_UpdateScreen();
rotate = (float)strtod(cl.configstrings[CS_SKYROTATE], (char **)NULL); rotate = (float)strtod(cl.configstrings[CS_SKYROTATE], (char **)NULL);
sscanf(cl.configstrings[CS_SKYAXIS], "%f %f %f", &axis[0], &axis[1], &axis[2]); sscanf(cl.configstrings[CS_SKYAXIS], "%f %f %f", &axis[0], &axis[1], &axis[2]);
re.SetSky(cl.configstrings[CS_SKY], rotate, axis); R_SetSky(cl.configstrings[CS_SKY], rotate, axis);
Com_Printf(" \r"); Com_Printf(" \r");
/* the renderer can now free unneeded stuff */ /* the renderer can now free unneeded stuff */
re.EndRegistration(); R_EndRegistration();
/* clear any lines of console text */ /* clear any lines of console text */
Con_ClearNotify(); Con_ClearNotify();
@ -442,7 +442,7 @@ V_Gun_Model_f(void)
} }
Com_sprintf(name, sizeof(name), "models/%s/tris.md2", Cmd_Argv(1)); Com_sprintf(name, sizeof(name), "models/%s/tris.md2", Cmd_Argv(1));
gun_model = re.RegisterModel(name); gun_model = R_RegisterModel(name);
} }
void void
@ -569,7 +569,7 @@ V_RenderView(float stereo_separation)
entitycmpfnc); entitycmpfnc);
} }
re.RenderFrame(&cl.refdef); R_RenderFrame(&cl.refdef);
if (cl_stats->value) if (cl_stats->value)
{ {

View File

@ -33,7 +33,7 @@
/* I will have to double check this but if my experience in adding CLIPS to /* I will have to double check this but if my experience in adding CLIPS to
* LLVM is any sign then long int will fail horribly but long long will work on * LLVM is any sign then long int will fail horribly but long long will work on
* ia64. I'll double check this on my zx6000. */ * ia64. I'll double check this on my zx6000. */
#define INT long long #define INT long long
#else #else
#define INT int #define INT int
#endif #endif
@ -423,7 +423,7 @@ void IN_Accumulate (void);
void CL_ParseLayout (void); void CL_ParseLayout (void);
extern refexport_t re; //extern refexport_t re;
void CL_Init (void); void CL_Init (void);

View File

@ -119,56 +119,56 @@ typedef struct {
/* /*
* these are the functions exported by the refresh module * these are the functions exported by the refresh module
*/ */
typedef struct { //typedef struct {
/* if api_version is different, the dll cannot be used */ // /* if api_version is different, the dll cannot be used */
int api_version; // int api_version;
//
/* called when the library is loaded */ // /* called when the library is loaded */
int (*Init)(void *hinstance, void *wndproc); // int (*Init)(void *hinstance, void *wndproc);
//
/* called before the library is unloaded */ // /* called before the library is unloaded */
void (*Shutdown)(void); // void (*Shutdown)(void);
//
/* All data that will be used in a level should be // /* All data that will be used in a level should be
registered before rendering any frames to prevent disk hits, // registered before rendering any frames to prevent disk hits,
but they can still be registered at a later time // but they can still be registered at a later time
if necessary. // if necessary.
//
EndRegistration will free any remaining data that wasn't registered. // EndRegistration will free any remaining data that wasn't registered.
Any model_s or skin_s pointers from before the BeginRegistration // Any model_s or skin_s pointers from before the BeginRegistration
are no longer valid after EndRegistration. // are no longer valid after EndRegistration.
//
Skins and images need to be differentiated, because skins // Skins and images need to be differentiated, because skins
are flood filled to eliminate mip map edge errors, and pics have // are flood filled to eliminate mip map edge errors, and pics have
an implicit "pics/" prepended to the name. (a pic name that starts with a // an implicit "pics/" prepended to the name. (a pic name that starts with a
slash will not use the "pics/" prefix or the ".pcx" postfix) */ // slash will not use the "pics/" prefix or the ".pcx" postfix) */
void (*BeginRegistration)(char *map); // void (*BeginRegistration)(char *map);
struct model_s *(*RegisterModel)(char *name); // struct model_s *(*RegisterModel)(char *name);
struct image_s *(*RegisterSkin)(char *name); // struct image_s *(*RegisterSkin)(char *name);
struct image_s *(*RegisterPic)(char *name); // struct image_s *(*RegisterPic)(char *name);
void (*SetSky)(char *name, float rotate, vec3_t axis); // void (*SetSky)(char *name, float rotate, vec3_t axis);
void (*EndRegistration)(void); // void (*EndRegistration)(void);
//
void (*RenderFrame)(refdef_t *fd); // void (*RenderFrame)(refdef_t *fd);
void (*DrawStretchPic)(int x, int y, int w, int h, char *name); // void (*DrawStretchPic)(int x, int y, int w, int h, char *name);
void (*DrawChar)(int x, int y, int c); // void (*DrawChar)(int x, int y, int c);
void (*DrawGetPicSize)(int *w, int *h, char *name); /* will return 0 0 if not found */ // void (*DrawGetPicSize)(int *w, int *h, char *name); /* will return 0 0 if not found */
void (*DrawPic)(int x, int y, char *name); // void (*DrawPic)(int x, int y, char *name);
void (*DrawTileClear)(int x, int y, int w, int h, char *name); // void (*DrawTileClear)(int x, int y, int w, int h, char *name);
void (*DrawFill)(int x, int y, int w, int h, int c); // void (*DrawFill)(int x, int y, int w, int h, int c);
void (*DrawFadeScreen)(void); // void (*DrawFadeScreen)(void);
//
/* Draw images for cinematic rendering (which can have a different palette). Note that calls */ // /* Draw images for cinematic rendering (which can have a different palette). Note that calls */
void (*DrawStretchRaw)(int x, int y, int w, int h, int cols, int rows, byte *data); // void (*DrawStretchRaw)(int x, int y, int w, int h, int cols, int rows, byte *data);
//
/* video mode and refresh state management entry points */ // /* video mode and refresh state management entry points */
void (*CinematicSetPalette)(const unsigned char *palette); /* NULL = game palette */ // void (*CinematicSetPalette)(const unsigned char *palette); /* NULL = game palette */
void (*BeginFrame)(float camera_separation); // void (*BeginFrame)(float camera_separation);
void (*EndFrame)(void); // void (*EndFrame)(void);
//
void (*AppActivate)(qboolean activate); // void (*AppActivate)(qboolean activate);
//
} refexport_t; //} refexport_t;
/* /*
* these are the functions imported by the refresh module * these are the functions imported by the refresh module
@ -211,11 +211,38 @@ typedef struct {
} refimport_t; } refimport_t;
/* this is the only function actually exported at the linker level */ /* this is the only function actually exported at the linker level */
typedef refexport_t (*R_GetRefAPI_t)(refimport_t); //typedef refexport_t (*R_GetRefAPI_t)(refimport_t);
/* */ /* This will be deleted */
refexport_t R_GetRefAPI(refimport_t rimp); //refexport_t R_GetRefAPI(refimport_t rimp);
void *R_GetRefAPI(refimport_t rimp);
/*
* Specifies the model that will be used as the world
*/
void R_BeginRegistration(char *map); void R_BeginRegistration(char *map);
/*
* Refresh API
*/
struct model_s *R_RegisterModel(char *name);
struct image_s *R_RegisterSkin(char *name);
void R_SetSky(char *name, float rotate, vec3_t axis);
void R_EndRegistration(void);
struct image_s *Draw_FindPic(char *name);
void R_RenderFrame(refdef_t *fd);
void Draw_GetPicSize(int *w, int *h, char *name);
void Draw_Pic(int x, int y, char *name);
void Draw_StretchPic(int x, int y, int w, int h, char *name);
void Draw_Char(int x, int y, int c);
void Draw_TileClear(int x, int y, int w, int h, char *name);
void Draw_Fill(int x, int y, int w, int h, int c);
void Draw_FadeScreen(void);
void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data);
int R_Init(void *hinstance, void *hWnd);
void R_Shutdown(void);
void R_SetPalette(const unsigned char *palette);
void R_BeginFrame(float camera_separation);
void GLimp_EndFrame(void);
#endif #endif

View File

@ -83,8 +83,8 @@ M_Banner(char *name)
{ {
int w, h; int w, h;
re.DrawGetPicSize(&w, &h, name); Draw_GetPicSize(&w, &h, name);
re.DrawPic(viddef.width / 2 - w / 2, viddef.height / 2 - 110, name); Draw_Pic(viddef.width / 2 - w / 2, viddef.height / 2 - 110, name);
} }
void void
@ -331,7 +331,7 @@ Default_MenuKey(menuframework_s *m, int key)
static void static void
M_DrawCharacter(int cx, int cy, int num) M_DrawCharacter(int cx, int cy, int num)
{ {
re.DrawChar(cx + ((viddef.width - 320) >> 1), cy + ((viddef.height - 240) >> 1), num); Draw_Char(cx + ((viddef.width - 320) >> 1), cy + ((viddef.height - 240) >> 1), num);
} }
static void static void
@ -360,7 +360,7 @@ M_Print(int x, int y, char *str)
void void
M_DrawPic(int x, int y, char *pic) M_DrawPic(int x, int y, char *pic)
{ {
re.DrawPic(x + ((viddef.width - 320) >> 1), Draw_Pic(x + ((viddef.width - 320) >> 1),
y + ((viddef.height - 240) >> 1), y + ((viddef.height - 240) >> 1),
pic); pic);
} }
@ -384,14 +384,14 @@ M_DrawCursor(int x, int y, int f)
{ {
Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", i); Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", i);
re.RegisterPic(cursorname); Draw_FindPic(cursorname);
} }
cached = true; cached = true;
} }
Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", f); Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", f);
re.DrawPic(x, y, cursorname); Draw_Pic(x, y, cursorname);
} }
static void static void
@ -527,7 +527,7 @@ M_Main_Draw(void)
for (i = 0; names[i] != 0; i++) for (i = 0; names[i] != 0; i++)
{ {
re.DrawGetPicSize(&w, &h, names[i]); Draw_GetPicSize(&w, &h, names[i]);
if (w > widest) if (w > widest)
{ {
@ -544,21 +544,21 @@ M_Main_Draw(void)
{ {
if (i != m_main_cursor) if (i != m_main_cursor)
{ {
re.DrawPic(xoffset, ystart + i * 40 + 13, names[i]); Draw_Pic(xoffset, ystart + i * 40 + 13, names[i]);
} }
} }
strcpy(litname, names[m_main_cursor]); strcpy(litname, names[m_main_cursor]);
strcat(litname, "_sel"); strcat(litname, "_sel");
re.DrawPic(xoffset, ystart + m_main_cursor * 40 + 13, litname); Draw_Pic(xoffset, ystart + m_main_cursor * 40 + 13, litname);
M_DrawCursor(xoffset - 25, ystart + m_main_cursor * 40 + 11, M_DrawCursor(xoffset - 25, ystart + m_main_cursor * 40 + 11,
(int)(cls.realtime / 100) % NUM_CURSOR_FRAMES); (int)(cls.realtime / 100) % NUM_CURSOR_FRAMES);
re.DrawGetPicSize(&w, &h, "m_main_plaque"); Draw_GetPicSize(&w, &h, "m_main_plaque");
re.DrawPic(xoffset - 30 - w, ystart, "m_main_plaque"); Draw_Pic(xoffset - 30 - w, ystart, "m_main_plaque");
re.DrawPic(xoffset - 30 - w, ystart + h + 5, "m_main_logo"); Draw_Pic(xoffset - 30 - w, ystart + h + 5, "m_main_logo");
} }
const char * const char *
@ -816,12 +816,12 @@ KeyCursorDrawFunc(menuframework_s *menu)
{ {
if (bind_grab) if (bind_grab)
{ {
re.DrawChar(menu->x, menu->y + menu->cursor * 9, '='); Draw_Char(menu->x, menu->y + menu->cursor * 9, '=');
} }
else else
{ {
re.DrawChar(menu->x, menu->y + menu->cursor * 9, 12 + Draw_Char(menu->x, menu->y + menu->cursor * 9, 12 +
((int)(Sys_Milliseconds() / 250) & 1)); ((int)(Sys_Milliseconds() / 250) & 1));
} }
} }
@ -1271,7 +1271,7 @@ UpdateSoundQualityFunc(void *unused)
M_Popup(); M_Popup();
/* the text box won't show up unless we do a buffer swap */ /* the text box won't show up unless we do a buffer swap */
re.EndFrame(); GLimp_EndFrame();
CL_Snd_Restart_f(); CL_Snd_Restart_f();
} }
@ -1899,12 +1899,12 @@ M_Credits_MenuDraw(void)
if (bold) if (bold)
{ {
re.DrawChar(x, y, credits[i][j + stringoffset] + 128); Draw_Char(x, y, credits[i][j + stringoffset] + 128);
} }
else else
{ {
re.DrawChar(x, y, credits[i][j + stringoffset]); Draw_Char(x, y, credits[i][j + stringoffset]);
} }
} }
} }
@ -2588,7 +2588,7 @@ SearchLocalGames(void)
M_Popup(); M_Popup();
/* the text box won't show up unless we do a buffer swap */ /* the text box won't show up unless we do a buffer swap */
re.EndFrame(); GLimp_EndFrame();
/* send out info packets */ /* send out info packets */
CL_PingServers_f(); CL_PingServers_f();
@ -2837,10 +2837,10 @@ StartServer_MenuInit(void)
int length; int length;
int i; int i;
FILE *fp; FILE *fp;
/* initialize list of maps once, reuse it afterwards (=> it isn't freed) */ /* initialize list of maps once, reuse it afterwards (=> it isn't freed) */
if (mapnames == NULL) if (mapnames == NULL)
{ {
/* load the list of map names */ /* load the list of map names */
Com_sprintf(mapsname, sizeof(mapsname), "%s/maps.lst", FS_Gamedir()); Com_sprintf(mapsname, sizeof(mapsname), "%s/maps.lst", FS_Gamedir());
@ -4213,12 +4213,12 @@ PlayerConfig_MenuDraw(void)
Com_sprintf(scratch, sizeof(scratch), "players/%s/tris.md2", Com_sprintf(scratch, sizeof(scratch), "players/%s/tris.md2",
s_pmi[s_player_model_box.curvalue].directory); s_pmi[s_player_model_box.curvalue].directory);
entity.model = re.RegisterModel(scratch); entity.model = R_RegisterModel(scratch);
Com_sprintf(scratch, sizeof(scratch), "players/%s/%s.pcx", Com_sprintf(scratch, sizeof(scratch), "players/%s/%s.pcx",
s_pmi[s_player_model_box.curvalue].directory, s_pmi[s_player_model_box.curvalue].directory,
s_pmi[s_player_model_box.curvalue].skindisplaynames[ s_pmi[s_player_model_box.curvalue].skindisplaynames[
s_player_skin_box.curvalue]); s_player_skin_box.curvalue]);
entity.skin = re.RegisterSkin(scratch); entity.skin = R_RegisterSkin(scratch);
entity.flags = RF_FULLBRIGHT; entity.flags = RF_FULLBRIGHT;
entity.origin[0] = 80; entity.origin[0] = 80;
entity.origin[1] = 0; entity.origin[1] = 0;
@ -4247,13 +4247,13 @@ PlayerConfig_MenuDraw(void)
refdef.width / 8, refdef.height / 8); refdef.width / 8, refdef.height / 8);
refdef.height += 4; refdef.height += 4;
re.RenderFrame(&refdef); R_RenderFrame(&refdef);
Com_sprintf(scratch, sizeof(scratch), "/players/%s/%s_i.pcx", 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].directory,
s_pmi[s_player_model_box.curvalue].skindisplaynames[ s_pmi[s_player_model_box.curvalue].skindisplaynames[
s_player_skin_box.curvalue]); s_player_skin_box.curvalue]);
re.DrawPic(s_player_config_menu.x - 40, refdef.y, scratch); Draw_Pic(s_player_config_menu.x - 40, refdef.y, scratch);
} }
} }
@ -4344,8 +4344,8 @@ M_Quit_Draw(void)
{ {
int w, h; int w, h;
re.DrawGetPicSize(&w, &h, "quit"); Draw_GetPicSize(&w, &h, "quit");
re.DrawPic((viddef.width - w) / 2, (viddef.height - h) / 2, "quit"); Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "quit");
} }
static void static void
@ -4389,12 +4389,12 @@ M_Draw(void)
/* dim everything behind it down */ /* dim everything behind it down */
if (cl.cinematictime > 0) if (cl.cinematictime > 0)
{ {
re.DrawFill(0, 0, viddef.width, viddef.height, 0); Draw_Fill(0, 0, viddef.width, viddef.height, 0);
} }
else else
{ {
re.DrawFadeScreen(); Draw_FadeScreen();
} }
m_drawfunc(); m_drawfunc();

View File

@ -42,13 +42,13 @@ static void SpinControl_DoSlide(menulist_s *s, int dir);
#define RCOLUMN_OFFSET 16 #define RCOLUMN_OFFSET 16
#define LCOLUMN_OFFSET -16 #define LCOLUMN_OFFSET -16
extern refexport_t re; //extern refexport_t re;
extern viddef_t viddef; extern viddef_t viddef;
#define VID_WIDTH viddef.width #define VID_WIDTH viddef.width
#define VID_HEIGHT viddef.height #define VID_HEIGHT viddef.height
#define Draw_Char re.DrawChar //#define Draw_Char re.DrawChar
#define Draw_Fill re.DrawFill //#define Draw_Fill re.DrawFill
void void
Action_DoEnter(menuaction_s *a) Action_DoEnter(menuaction_s *a)
@ -138,11 +138,11 @@ Field_Draw(menufield_s *f)
Draw_Char(f->generic.x + f->generic.parent->x + 16, Draw_Char(f->generic.x + f->generic.parent->x + 16,
f->generic.y + f->generic.parent->y + 4, 24); f->generic.y + f->generic.parent->y + 4, 24);
Draw_Char(f->generic.x + f->generic.parent->x + 24 + Draw_Char(f->generic.x + f->generic.parent->x + 24 +
f->visible_length * 8, f->generic.y + f->visible_length * 8, f->generic.y +
f->generic.parent->y - 4, 20); f->generic.parent->y - 4, 20);
Draw_Char(f->generic.x + f->generic.parent->x + 24 + Draw_Char(f->generic.x + f->generic.parent->x + 24 +
f->visible_length * 8, f->generic.y + f->visible_length * 8, f->generic.y +
f->generic.parent->y + 4, 26); f->generic.parent->y + 4, 26);
for (i = 0; i < f->visible_length; i++) for (i = 0; i < f->visible_length; i++)
@ -172,14 +172,14 @@ Field_Draw(menufield_s *f)
if (((int)(Sys_Milliseconds() / 250)) & 1) if (((int)(Sys_Milliseconds() / 250)) & 1)
{ {
Draw_Char(f->generic.x + f->generic.parent->x + Draw_Char(f->generic.x + f->generic.parent->x +
(offset + 2) * 8 + 8, f->generic.y + (offset + 2) * 8 + 8, f->generic.y +
f->generic.parent->y, 11); f->generic.parent->y, 11);
} }
else else
{ {
Draw_Char(f->generic.x + f->generic.parent->x + Draw_Char(f->generic.x + f->generic.parent->x +
(offset + 2) * 8 + 8, f->generic.y + (offset + 2) * 8 + 8, f->generic.y +
f->generic.parent->y, ' '); f->generic.parent->y, ' ');
} }
} }
@ -633,14 +633,14 @@ MenuList_Draw(menulist_s *l)
const char **n; const char **n;
int y = 0; int y = 0;
Menu_DrawStringR2LDark(l->generic.x + l->generic.parent->x Menu_DrawStringR2LDark(l->generic.x + l->generic.parent->x
+ LCOLUMN_OFFSET, l->generic.y + l->generic.parent->y, + LCOLUMN_OFFSET, l->generic.y + l->generic.parent->y,
l->generic.name); l->generic.name);
n = l->itemnames; n = l->itemnames;
Draw_Fill(l->generic.x - 112 + l->generic.parent->x, Draw_Fill(l->generic.x - 112 + l->generic.parent->x,
l->generic.parent->y + l->generic.y + l->generic.parent->y + l->generic.y +
l->curvalue * 10 + 10, 128, 10, 16); l->curvalue * 10 + 10, 128, 10, 16);
while (*n) while (*n)
@ -697,7 +697,7 @@ Slider_Draw(menuslider_s *s)
LCOLUMN_OFFSET, s->generic.y + s->generic.parent->y, LCOLUMN_OFFSET, s->generic.y + s->generic.parent->y,
s->generic.name); s->generic.name);
s->range = (s->curvalue - s->minvalue) / s->range = (s->curvalue - s->minvalue) /
(float)(s->maxvalue - s->minvalue); (float)(s->maxvalue - s->minvalue);
if (s->range < 0) if (s->range < 0)
@ -716,12 +716,12 @@ Slider_Draw(menuslider_s *s)
for (i = 0; i < SLIDER_RANGE; i++) for (i = 0; i < SLIDER_RANGE; i++)
{ {
Draw_Char(RCOLUMN_OFFSET + s->generic.x + i * 8 + Draw_Char(RCOLUMN_OFFSET + s->generic.x + i * 8 +
s->generic.parent->x + 8, s->generic.y + s->generic.parent->x + 8, s->generic.y +
s->generic.parent->y, 129); s->generic.parent->y, 129);
} }
Draw_Char(RCOLUMN_OFFSET + s->generic.x + i * 8 + Draw_Char(RCOLUMN_OFFSET + s->generic.x + i * 8 +
s->generic.parent->x + 8, s->generic.y + s->generic.parent->x + 8, s->generic.y +
s->generic.parent->y, 130); s->generic.parent->y, 130);
Draw_Char((int)(8 + RCOLUMN_OFFSET + s->generic.parent->x + Draw_Char((int)(8 + RCOLUMN_OFFSET + s->generic.parent->x +
@ -765,8 +765,8 @@ SpinControl_Draw(menulist_s *s)
if (!strchr(s->itemnames[s->curvalue], '\n')) if (!strchr(s->itemnames[s->curvalue], '\n'))
{ {
Menu_DrawString(RCOLUMN_OFFSET + s->generic.x + Menu_DrawString(RCOLUMN_OFFSET + s->generic.x +
s->generic.parent->x, s->generic.y + s->generic.parent->x, s->generic.y +
s->generic.parent->y, s->generic.parent->y,
s->itemnames[s->curvalue]); s->itemnames[s->curvalue]);
} }
@ -775,11 +775,11 @@ SpinControl_Draw(menulist_s *s)
strcpy(buffer, s->itemnames[s->curvalue]); strcpy(buffer, s->itemnames[s->curvalue]);
*strchr(buffer, '\n') = 0; *strchr(buffer, '\n') = 0;
Menu_DrawString(RCOLUMN_OFFSET + s->generic.x + Menu_DrawString(RCOLUMN_OFFSET + s->generic.x +
s->generic.parent->x, s->generic.y + s->generic.parent->x, s->generic.y +
s->generic.parent->y, buffer); s->generic.parent->y, buffer);
strcpy(buffer, strchr(s->itemnames[s->curvalue], '\n') + 1); strcpy(buffer, strchr(s->itemnames[s->curvalue], '\n') + 1);
Menu_DrawString(RCOLUMN_OFFSET + s->generic.x + Menu_DrawString(RCOLUMN_OFFSET + s->generic.x +
s->generic.parent->x, s->generic.y + s->generic.parent->x, s->generic.y +
s->generic.parent->y + 10, buffer); s->generic.parent->y + 10, buffer);
} }
} }

View File

@ -380,8 +380,8 @@ VID_MenuDraw(void)
int w, h; int w, h;
/* draw the banner */ /* draw the banner */
re.DrawGetPicSize(&w, &h, "m_banner_video"); Draw_GetPicSize(&w, &h, "m_banner_video");
re.DrawPic(viddef.width / 2 - w / 2, viddef.height / 2 - 110, Draw_Pic(viddef.width / 2 - w / 2, viddef.height / 2 - 110,
"m_banner_video"); "m_banner_video");
/* move cursor to a reasonable starting position */ /* move cursor to a reasonable starting position */

View File

@ -285,8 +285,6 @@ extern unsigned d_8to24table[256];
extern int registration_sequence; extern int registration_sequence;
void V_AddBlend(float r, float g, float b, float a, float *v_blend); void V_AddBlend(float r, float g, float b, float a, float *v_blend);
int R_Init(void *hinstance, void *hWnd);
void R_Shutdown(void);
void R_RenderView(refdef_t *fd); void R_RenderView(refdef_t *fd);
void R_ScreenShot(void); void R_ScreenShot(void);
@ -314,18 +312,7 @@ void R_MarkLights(dlight_t *light, int bit, mnode_t *node);
void COM_StripExtension(char *in, char *out); void COM_StripExtension(char *in, char *out);
void Draw_GetPicSize(int *w, int *h, char *name);
void Draw_Pic(int x, int y, char *name);
void Draw_StretchPic(int x, int y, int w, int h, char *name);
void Draw_Char(int x, int y, int c);
void Draw_TileClear(int x, int y, int w, int h, char *name);
void Draw_Fill(int x, int y, int w, int h, int c);
void Draw_FadeScreen(void);
void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data);
void R_BeginFrame(float camera_separation);
void R_SwapBuffers(int); void R_SwapBuffers(int);
void R_SetPalette(const unsigned char *palette);
int Draw_GetPalette(void); int Draw_GetPalette(void);
@ -425,7 +412,6 @@ extern glstate_t gl_state;
extern refimport_t ri; extern refimport_t ri;
void GLimp_BeginFrame(float camera_separation); void GLimp_BeginFrame(float camera_separation);
void GLimp_EndFrame(void);
int GLimp_Init(void); int GLimp_Init(void);
void GLimp_Shutdown(void); void GLimp_Shutdown(void);
int GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen); int GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen);

View File

@ -29,13 +29,7 @@
#define NUM_BEAM_SEGS 6 #define NUM_BEAM_SEGS 6
void R_Clear(void); void R_Clear(void);
void R_BeginRegistration(char *map);
struct model_s *R_RegisterModel(char *name);
struct image_s *R_RegisterSkin(char *name);
void R_SetSky(char *name, float rotate, vec3_t axis);
void R_EndRegistration(void);
void R_RenderFrame(refdef_t *fd);
struct image_s *Draw_FindPic(char *name);
void Draw_Pic(int x, int y, char *name); void Draw_Pic(int x, int y, char *name);
void Draw_Char(int x, int y, int c); void Draw_Char(int x, int y, int c);
@ -1579,14 +1573,15 @@ R_DrawBeam(entity_t *e)
qglDepthMask(GL_TRUE); qglDepthMask(GL_TRUE);
} }
refexport_t //refexport_t
void *
R_GetRefAPI(refimport_t rimp) R_GetRefAPI(refimport_t rimp)
{ {
refexport_t re; //refexport_t re;
ri = rimp; ri = rimp;
re.api_version = API_VERSION; /*re.api_version = API_VERSION;
re.BeginRegistration = R_BeginRegistration; re.BeginRegistration = R_BeginRegistration;
re.RegisterModel = R_RegisterModel; re.RegisterModel = R_RegisterModel;
@ -1614,11 +1609,12 @@ R_GetRefAPI(refimport_t rimp)
re.BeginFrame = R_BeginFrame; re.BeginFrame = R_BeginFrame;
re.EndFrame = GLimp_EndFrame; re.EndFrame = GLimp_EndFrame;
re.AppActivate = NULL; re.AppActivate = NULL;*/
Swap_Init(); Swap_Init();
return re; //return re;
return NULL;
} }
/* /*