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 */
refexport_t re;
//refexport_t re;
/* Console variables that we need to access from this module */
cvar_t *vid_gamma;
@ -167,7 +167,7 @@ VID_NewWindow(int width, int height)
void
VID_FreeReflib(void)
{
memset(&re, 0, sizeof(re));
//memset(&re, 0, sizeof(re));
}
qboolean
@ -205,7 +205,7 @@ VID_LoadRefresh(void)
ri.Vid_NewWindow = VID_NewWindow;
// Get refresher API exports
re = R_GetRefAPI(ri);
R_GetRefAPI(ri);
/* Init IN (Mouse) */
in_state.IN_CenterView_fp = IN_CenterView;
@ -225,7 +225,8 @@ VID_LoadRefresh(void)
ref_active = true;
// 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? :(
return false;
@ -286,7 +287,7 @@ VID_Shutdown(void)
IN_BackendShutdown();
/* Shut down the renderer */
re.Shutdown();
R_Shutdown();
// Get rid of refexport function pointers
// (soon to be deleted)

View file

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

View file

@ -41,7 +41,7 @@ DrawString(int x, int y, char *s)
{
while (*s)
{
re.DrawChar(x, y, *s);
Draw_Char(x, y, *s);
x += 8;
s++;
}
@ -52,7 +52,7 @@ DrawAltString(int x, int y, char *s)
{
while (*s)
{
re.DrawChar(x, y, *s ^ 0x80);
Draw_Char(x, y, *s ^ 0x80);
x += 8;
s++;
}
@ -493,7 +493,7 @@ Con_DrawInput(void)
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 */
@ -540,7 +540,7 @@ Con_DrawNotify(void)
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;
@ -570,11 +570,11 @@ Con_DrawNotify(void)
while (s[x])
{
re.DrawChar((x + skip) << 3, v, s[x]);
Draw_Char((x + skip) << 3, v, s[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;
}
@ -617,7 +617,7 @@ Con_DrawConsole(float frac)
}
/* draw the background */
re.DrawStretchPic(0, -viddef.height + lines, viddef.width,
Draw_StretchPic(0, -viddef.height + lines, viddef.width,
viddef.height, "conback");
SCR_AddDirtyPoint(0, 0);
SCR_AddDirtyPoint(viddef.width - 1, lines - 1);
@ -626,7 +626,7 @@ Con_DrawConsole(float frac)
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);
@ -637,7 +637,7 @@ Con_DrawConsole(float frac)
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 */
@ -653,7 +653,7 @@ Con_DrawConsole(float frac)
/* draw arrows to show the buffer is backscrolled */
for (x = 0; x < con.linewidth; x += 4)
{
re.DrawChar((x + 1) << 3, y, '^');
Draw_Char((x + 1) << 3, y, '^');
}
y -= 8;
@ -678,7 +678,7 @@ Con_DrawConsole(float frac)
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++)
{
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);
md2 = re.RegisterModel(buffer);
md2 = R_RegisterModel(buffer);
if (!md2)
{
/* not found, try default weapon model */
Com_sprintf(buffer, sizeof(buffer), "players/%s/weapon.md2", model);
md2 = re.RegisterModel(buffer);
md2 = R_RegisterModel(buffer);
if (!md2)
{
/* no, revert to the male model */
Com_sprintf(buffer, sizeof(buffer), "players/%s/%s",
"male", base + 1);
md2 = re.RegisterModel(buffer);
md2 = R_RegisterModel(buffer);
if (!md2)
{
/* last try, default 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))
{
ent.skin = re.RegisterSkin("players/male/disguise.pcx");
ent.model = re.RegisterModel("players/male/tris.md2");
ent.skin = R_RegisterSkin("players/male/disguise.pcx");
ent.model = R_RegisterModel("players/male/tris.md2");
}
else if (!strncmp((char *)ent.skin, "players/female", 14))
{
ent.skin = re.RegisterSkin("players/female/disguise.pcx");
ent.model = re.RegisterModel("players/female/tris.md2");
ent.skin = R_RegisterSkin("players/female/disguise.pcx");
ent.model = R_RegisterModel("players/female/tris.md2");
}
else if (!strncmp((char *)ent.skin, "players/cyborg", 14))
{
ent.skin = re.RegisterSkin("players/cyborg/disguise.pcx");
ent.model = re.RegisterModel("players/cyborg/tris.md2");
ent.skin = R_RegisterSkin("players/cyborg/disguise.pcx");
ent.model = R_RegisterModel("players/cyborg/tris.md2");
}
}
}

View file

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

View file

@ -316,7 +316,7 @@ CL_Disconnect(void)
VectorClear(cl.refdef.blend);
re.CinematicSetPalette(NULL);
R_SetPalette(NULL);
M_ForceMenuOff();

View file

@ -920,11 +920,11 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
strcpy(weapon_filename, "players/male/weapon.md2");
strcpy(skin_filename, "players/male/grunt.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));
ci->weaponmodel[0] = re.RegisterModel(weapon_filename);
ci->skin = re.RegisterSkin(skin_filename);
ci->icon = re.RegisterPic(ci->iconname);
ci->weaponmodel[0] = R_RegisterModel(weapon_filename);
ci->skin = R_RegisterSkin(skin_filename);
ci->icon = Draw_FindPic(ci->iconname);
}
else
{
@ -950,20 +950,20 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
/* model file */
Com_sprintf(model_filename, sizeof(model_filename),
"players/%s/tris.md2", model_name);
ci->model = re.RegisterModel(model_filename);
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 = re.RegisterModel(model_filename);
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 = re.RegisterSkin(skin_filename);
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) */
@ -973,12 +973,12 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
strcpy(model_name, "male");
Com_sprintf(model_filename, sizeof(model_filename),
"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 */
Com_sprintf(skin_filename, sizeof(skin_filename),
"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
@ -988,7 +988,7 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
/* 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 = re.RegisterSkin(skin_filename);
ci->skin = R_RegisterSkin(skin_filename);
}
/* weapon file */
@ -996,14 +996,14 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
{
Com_sprintf(weapon_filename, sizeof(weapon_filename),
"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))
{
/* try male */
Com_sprintf(weapon_filename, sizeof(weapon_filename),
"players/male/%s", cl_weaponmodels[i]);
ci->weaponmodel[i] = re.RegisterModel(weapon_filename);
ci->weaponmodel[i] = R_RegisterModel(weapon_filename);
}
if (!cl_vwep->value)
@ -1015,7 +1015,7 @@ CL_LoadClientinfo(clientinfo_t *ci, char *s)
/* icon file */
Com_sprintf(ci->iconname, sizeof(ci->iconname),
"/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 */
@ -1100,7 +1100,7 @@ CL_ParseConfigString(void)
{
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] == '*')
{
@ -1125,7 +1125,7 @@ CL_ParseConfigString(void)
{
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))

View file

@ -135,7 +135,7 @@ SCR_DrawDebugGraph(void)
x = scr_vrect.x;
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);
for (a = 0; a < w; a++)
@ -152,7 +152,7 @@ SCR_DrawDebugGraph(void)
}
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)
{
re.DrawChar(x, y, start[j]);
Draw_Char(x, y, start[j]);
if (!remaining--)
{
@ -408,7 +408,7 @@ SCR_Sky_f(void)
axis[2] = 1;
}
re.SetSky(Cmd_Argv(1), rotate, axis);
R_SetSky(Cmd_Argv(1), rotate, axis);
}
void
@ -445,7 +445,7 @@ SCR_DrawNet(void)
return;
}
re.DrawPic(scr_vrect.x + 64, scr_vrect.y, "net");
Draw_Pic(scr_vrect.x + 64, scr_vrect.y, "net");
}
void
@ -463,8 +463,8 @@ SCR_DrawPause(void)
return;
}
re.DrawGetPicSize(&w, &h, "pause");
re.DrawPic((viddef.width - w) / 2, viddef.height / 2 + 8, "pause");
Draw_GetPicSize(&w, &h, "pause");
Draw_Pic((viddef.width - w) / 2, viddef.height / 2 + 8, "pause");
}
void
@ -478,8 +478,8 @@ SCR_DrawLoading(void)
}
scr_draw_loading = false;
re.DrawGetPicSize(&w, &h, "loading");
re.DrawPic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading");
Draw_GetPicSize(&w, &h, "loading");
Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading");
}
/*
@ -534,7 +534,7 @@ SCR_DrawConsole(void)
{
/* connected, but can't render */
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;
}
@ -647,15 +647,15 @@ SCR_TimeRefresh_f(void)
for (j = 0; j < 1000; j++)
{
re.BeginFrame(0);
R_BeginFrame(0);
for (i = 0; i < 128; i++)
{
cl.refdef.viewangles[1] = i / 128.0f * 360.0f;
re.RenderFrame(&cl.refdef);
R_RenderFrame(&cl.refdef);
}
re.EndFrame();
GLimp_EndFrame();
}
}
else
@ -664,9 +664,9 @@ SCR_TimeRefresh_f(void)
{
cl.refdef.viewangles[1] = i / 128.0f * 360.0f;
re.BeginFrame(0);
re.RenderFrame(&cl.refdef);
re.EndFrame();
R_BeginFrame(0);
R_RenderFrame(&cl.refdef);
GLimp_EndFrame();
}
}
@ -788,7 +788,7 @@ SCR_TileClear(void)
{
/* clear above view screen */
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.y1 = top;
}
@ -797,7 +797,7 @@ SCR_TileClear(void)
{
/* clear below view screen */
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.y2 = bottom;
}
@ -806,7 +806,7 @@ SCR_TileClear(void)
{
/* clear left of view screen */
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");
clear.x1 = left;
}
@ -815,7 +815,7 @@ SCR_TileClear(void)
{
/* clear left of view screen */
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 = right;
}
@ -909,7 +909,7 @@ DrawHUDString(char *string, int x, int y, int centerwidth, int xor)
for (i = 0; i < width; i++)
{
re.DrawChar(x, y, line[i] ^ xor);
Draw_Char(x, y, line[i] ^ xor);
x += 8;
}
@ -966,7 +966,7 @@ SCR_DrawField(int x, int y, int color, int width, int value)
frame = *ptr - '0';
}
re.DrawPic(x, y, sb_nums[color][frame]);
Draw_Pic(x, y, sb_nums[color][frame]);
x += CHAR_WIDTH;
ptr++;
l--;
@ -985,7 +985,7 @@ SCR_TouchPics(void)
{
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",
(int)(crosshair->value));
re.DrawGetPicSize(&crosshair_width, &crosshair_height, crosshair_pic);
Draw_GetPicSize(&crosshair_width, &crosshair_height, crosshair_pic);
if (!crosshair_width)
{
@ -1098,7 +1098,7 @@ SCR_ExecuteLayoutString(char *s)
{
SCR_AddDirtyPoint(x, y);
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;
@ -1146,7 +1146,7 @@ SCR_ExecuteLayoutString(char *s)
ci = &cl.baseclientinfo;
}
re.DrawPic(x, y, ci->iconname);
Draw_Pic(x, y, ci->iconname);
continue;
}
@ -1205,7 +1205,7 @@ SCR_ExecuteLayoutString(char *s)
token = COM_Parse(&s);
SCR_AddDirtyPoint(x, y);
SCR_AddDirtyPoint(x + 23, y + 23);
re.DrawPic(x, y, (char *)token);
Draw_Pic(x, y, (char *)token);
continue;
}
@ -1243,7 +1243,7 @@ SCR_ExecuteLayoutString(char *s)
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);
@ -1273,7 +1273,7 @@ SCR_ExecuteLayoutString(char *s)
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);
@ -1297,7 +1297,7 @@ SCR_ExecuteLayoutString(char *s)
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);
@ -1431,17 +1431,17 @@ SCR_UpdateScreen(void)
for (i = 0; i < numframes; i++)
{
re.BeginFrame(separation[i]);
R_BeginFrame(separation[i]);
if (scr_draw_loading == 2)
{
/* loading plaque over black screen */
int w, h;
re.CinematicSetPalette(NULL);
R_SetPalette(NULL);
scr_draw_loading = false;
re.DrawGetPicSize(&w, &h, "loading");
re.DrawPic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading");
Draw_GetPicSize(&w, &h, "loading");
Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "loading");
}
/* if a cinematic is supposed to be running,
@ -1452,7 +1452,7 @@ SCR_UpdateScreen(void)
{
if (cl.cinematicpalette_active)
{
re.CinematicSetPalette(NULL);
R_SetPalette(NULL);
cl.cinematicpalette_active = false;
}
@ -1462,7 +1462,7 @@ SCR_UpdateScreen(void)
{
if (cl.cinematicpalette_active)
{
re.CinematicSetPalette(NULL);
R_SetPalette(NULL);
cl.cinematicpalette_active = false;
}
@ -1478,7 +1478,7 @@ SCR_UpdateScreen(void)
/* make sure the game palette is active */
if (cl.cinematicpalette_active)
{
re.CinematicSetPalette(NULL);
R_SetPalette(NULL);
cl.cinematicpalette_active = false;
}
@ -1533,7 +1533,7 @@ SCR_UpdateScreen(void)
}
}
re.EndFrame();
GLimp_EndFrame();
}
void
@ -1570,7 +1570,7 @@ SCR_DrawCrosshair(void)
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),
crosshair_pic);
}

View file

@ -149,34 +149,34 @@ CL_RegisterTEntSounds(void)
void
CL_RegisterTEntModels(void)
{
cl_mod_explode = re.RegisterModel("models/objects/explode/tris.md2");
cl_mod_smoke = re.RegisterModel("models/objects/smoke/tris.md2");
cl_mod_flash = re.RegisterModel("models/objects/flash/tris.md2");
cl_mod_parasite_segment = re.RegisterModel("models/monsters/parasite/segment/tris.md2");
cl_mod_grapple_cable = re.RegisterModel("models/ctf/segment/tris.md2");
cl_mod_parasite_tip = re.RegisterModel("models/monsters/parasite/tip/tris.md2");
cl_mod_explo4 = re.RegisterModel("models/objects/r_explode/tris.md2");
cl_mod_bfg_explo = re.RegisterModel("sprites/s_bfg2.sp2");
cl_mod_powerscreen = re.RegisterModel("models/items/armor/effect/tris.md2");
cl_mod_explode = R_RegisterModel("models/objects/explode/tris.md2");
cl_mod_smoke = R_RegisterModel("models/objects/smoke/tris.md2");
cl_mod_flash = R_RegisterModel("models/objects/flash/tris.md2");
cl_mod_parasite_segment = R_RegisterModel("models/monsters/parasite/segment/tris.md2");
cl_mod_grapple_cable = R_RegisterModel("models/ctf/segment/tris.md2");
cl_mod_parasite_tip = R_RegisterModel("models/monsters/parasite/tip/tris.md2");
cl_mod_explo4 = R_RegisterModel("models/objects/r_explode/tris.md2");
cl_mod_bfg_explo = R_RegisterModel("sprites/s_bfg2.sp2");
cl_mod_powerscreen = R_RegisterModel("models/items/armor/effect/tris.md2");
re.RegisterModel("models/objects/laser/tris.md2");
re.RegisterModel("models/objects/grenade2/tris.md2");
re.RegisterModel("models/weapons/v_machn/tris.md2");
re.RegisterModel("models/weapons/v_handgr/tris.md2");
re.RegisterModel("models/weapons/v_shotg2/tris.md2");
re.RegisterModel("models/objects/gibs/bone/tris.md2");
re.RegisterModel("models/objects/gibs/sm_meat/tris.md2");
re.RegisterModel("models/objects/gibs/bone2/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");
re.RegisterPic("w_machinegun");
re.RegisterPic("a_bullets");
re.RegisterPic("i_health");
re.RegisterPic("a_grenades");
Draw_FindPic("w_machinegun");
Draw_FindPic("a_bullets");
Draw_FindPic("i_health");
Draw_FindPic("a_grenades");
cl_mod_explo4_big = re.RegisterModel("models/objects/r_explode2/tris.md2");
cl_mod_lightning = re.RegisterModel("models/proj/lightning/tris.md2");
cl_mod_heatbeam = re.RegisterModel("models/proj/beam/tris.md2");
cl_mod_monster_heatbeam = re.RegisterModel("models/proj/widowbeam/tris.md2");
cl_mod_explo4_big = R_RegisterModel("models/objects/r_explode2/tris.md2");
cl_mod_lightning = R_RegisterModel("models/proj/lightning/tris.md2");
cl_mod_heatbeam = R_RegisterModel("models/proj/beam/tris.md2");
cl_mod_monster_heatbeam = R_RegisterModel("models/proj/widowbeam/tris.md2");
}
void

View file

@ -291,7 +291,7 @@ CL_PrepRefresh(void)
}
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] == '*')
{
@ -315,7 +315,7 @@ CL_PrepRefresh(void)
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();
}
@ -342,11 +342,11 @@ CL_PrepRefresh(void)
SCR_UpdateScreen();
rotate = (float)strtod(cl.configstrings[CS_SKYROTATE], (char **)NULL);
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");
/* the renderer can now free unneeded stuff */
re.EndRegistration();
R_EndRegistration();
/* clear any lines of console text */
Con_ClearNotify();
@ -442,7 +442,7 @@ V_Gun_Model_f(void)
}
Com_sprintf(name, sizeof(name), "models/%s/tris.md2", Cmd_Argv(1));
gun_model = re.RegisterModel(name);
gun_model = R_RegisterModel(name);
}
void
@ -569,7 +569,7 @@ V_RenderView(float stereo_separation)
entitycmpfnc);
}
re.RenderFrame(&cl.refdef);
R_RenderFrame(&cl.refdef);
if (cl_stats->value)
{

View file

@ -423,7 +423,7 @@ void IN_Accumulate (void);
void CL_ParseLayout (void);
extern refexport_t re;
//extern refexport_t re;
void CL_Init (void);

View file

@ -119,56 +119,56 @@ typedef struct {
/*
* these are the functions exported by the refresh module
*/
typedef struct {
/* if api_version is different, the dll cannot be used */
int api_version;
/* called when the library is loaded */
int (*Init)(void *hinstance, void *wndproc);
/* called before the library is unloaded */
void (*Shutdown)(void);
/* All data that will be used in a level should be
registered before rendering any frames to prevent disk hits,
but they can still be registered at a later time
if necessary.
EndRegistration will free any remaining data that wasn't registered.
Any model_s or skin_s pointers from before the BeginRegistration
are no longer valid after EndRegistration.
Skins and images need to be differentiated, because skins
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
slash will not use the "pics/" prefix or the ".pcx" postfix) */
void (*BeginRegistration)(char *map);
struct model_s *(*RegisterModel)(char *name);
struct image_s *(*RegisterSkin)(char *name);
struct image_s *(*RegisterPic)(char *name);
void (*SetSky)(char *name, float rotate, vec3_t axis);
void (*EndRegistration)(void);
void (*RenderFrame)(refdef_t *fd);
void (*DrawStretchPic)(int x, int y, int w, int h, char *name);
void (*DrawChar)(int x, int y, int c);
void (*DrawGetPicSize)(int *w, int *h, char *name); /* will return 0 0 if not found */
void (*DrawPic)(int x, int y, 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 (*DrawFadeScreen)(void);
/* 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);
/* video mode and refresh state management entry points */
void (*CinematicSetPalette)(const unsigned char *palette); /* NULL = game palette */
void (*BeginFrame)(float camera_separation);
void (*EndFrame)(void);
void (*AppActivate)(qboolean activate);
} refexport_t;
//typedef struct {
// /* if api_version is different, the dll cannot be used */
// int api_version;
//
// /* called when the library is loaded */
// int (*Init)(void *hinstance, void *wndproc);
//
// /* called before the library is unloaded */
// void (*Shutdown)(void);
//
// /* All data that will be used in a level should be
// registered before rendering any frames to prevent disk hits,
// but they can still be registered at a later time
// if necessary.
//
// EndRegistration will free any remaining data that wasn't registered.
// Any model_s or skin_s pointers from before the BeginRegistration
// are no longer valid after EndRegistration.
//
// Skins and images need to be differentiated, because skins
// 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
// slash will not use the "pics/" prefix or the ".pcx" postfix) */
// void (*BeginRegistration)(char *map);
// struct model_s *(*RegisterModel)(char *name);
// struct image_s *(*RegisterSkin)(char *name);
// struct image_s *(*RegisterPic)(char *name);
// void (*SetSky)(char *name, float rotate, vec3_t axis);
// void (*EndRegistration)(void);
//
// void (*RenderFrame)(refdef_t *fd);
// void (*DrawStretchPic)(int x, int y, int w, int h, char *name);
// void (*DrawChar)(int x, int y, int c);
// void (*DrawGetPicSize)(int *w, int *h, char *name); /* will return 0 0 if not found */
// void (*DrawPic)(int x, int y, 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 (*DrawFadeScreen)(void);
//
// /* 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);
//
// /* video mode and refresh state management entry points */
// void (*CinematicSetPalette)(const unsigned char *palette); /* NULL = game palette */
// void (*BeginFrame)(float camera_separation);
// void (*EndFrame)(void);
//
// void (*AppActivate)(qboolean activate);
//
//} refexport_t;
/*
* these are the functions imported by the refresh module
@ -211,11 +211,38 @@ typedef struct {
} refimport_t;
/* 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);
/* */
refexport_t R_GetRefAPI(refimport_t rimp);
/* This will be deleted */
//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);
/*
* 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

View file

@ -83,8 +83,8 @@ M_Banner(char *name)
{
int w, h;
re.DrawGetPicSize(&w, &h, name);
re.DrawPic(viddef.width / 2 - w / 2, viddef.height / 2 - 110, name);
Draw_GetPicSize(&w, &h, name);
Draw_Pic(viddef.width / 2 - w / 2, viddef.height / 2 - 110, name);
}
void
@ -331,7 +331,7 @@ Default_MenuKey(menuframework_s *m, int key)
static void
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
@ -360,7 +360,7 @@ M_Print(int x, int y, char *str)
void
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),
pic);
}
@ -384,14 +384,14 @@ M_DrawCursor(int x, int y, int f)
{
Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", i);
re.RegisterPic(cursorname);
Draw_FindPic(cursorname);
}
cached = true;
}
Com_sprintf(cursorname, sizeof(cursorname), "m_cursor%d", f);
re.DrawPic(x, y, cursorname);
Draw_Pic(x, y, cursorname);
}
static void
@ -527,7 +527,7 @@ M_Main_Draw(void)
for (i = 0; names[i] != 0; i++)
{
re.DrawGetPicSize(&w, &h, names[i]);
Draw_GetPicSize(&w, &h, names[i]);
if (w > widest)
{
@ -544,21 +544,21 @@ M_Main_Draw(void)
{
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]);
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,
(int)(cls.realtime / 100) % NUM_CURSOR_FRAMES);
re.DrawGetPicSize(&w, &h, "m_main_plaque");
re.DrawPic(xoffset - 30 - w, ystart, "m_main_plaque");
Draw_GetPicSize(&w, &h, "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 *
@ -816,12 +816,12 @@ KeyCursorDrawFunc(menuframework_s *menu)
{
if (bind_grab)
{
re.DrawChar(menu->x, menu->y + menu->cursor * 9, '=');
Draw_Char(menu->x, menu->y + menu->cursor * 9, '=');
}
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));
}
}
@ -1271,7 +1271,7 @@ UpdateSoundQualityFunc(void *unused)
M_Popup();
/* the text box won't show up unless we do a buffer swap */
re.EndFrame();
GLimp_EndFrame();
CL_Snd_Restart_f();
}
@ -1899,12 +1899,12 @@ M_Credits_MenuDraw(void)
if (bold)
{
re.DrawChar(x, y, credits[i][j + stringoffset] + 128);
Draw_Char(x, y, credits[i][j + stringoffset] + 128);
}
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();
/* the text box won't show up unless we do a buffer swap */
re.EndFrame();
GLimp_EndFrame();
/* send out info packets */
CL_PingServers_f();
@ -4213,12 +4213,12 @@ PlayerConfig_MenuDraw(void)
Com_sprintf(scratch, sizeof(scratch), "players/%s/tris.md2",
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",
s_pmi[s_player_model_box.curvalue].directory,
s_pmi[s_player_model_box.curvalue].skindisplaynames[
s_player_skin_box.curvalue]);
entity.skin = re.RegisterSkin(scratch);
entity.skin = R_RegisterSkin(scratch);
entity.flags = RF_FULLBRIGHT;
entity.origin[0] = 80;
entity.origin[1] = 0;
@ -4247,13 +4247,13 @@ PlayerConfig_MenuDraw(void)
refdef.width / 8, refdef.height / 8);
refdef.height += 4;
re.RenderFrame(&refdef);
R_RenderFrame(&refdef);
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[
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;
re.DrawGetPicSize(&w, &h, "quit");
re.DrawPic((viddef.width - w) / 2, (viddef.height - h) / 2, "quit");
Draw_GetPicSize(&w, &h, "quit");
Draw_Pic((viddef.width - w) / 2, (viddef.height - h) / 2, "quit");
}
static void
@ -4389,12 +4389,12 @@ M_Draw(void)
/* dim everything behind it down */
if (cl.cinematictime > 0)
{
re.DrawFill(0, 0, viddef.width, viddef.height, 0);
Draw_Fill(0, 0, viddef.width, viddef.height, 0);
}
else
{
re.DrawFadeScreen();
Draw_FadeScreen();
}
m_drawfunc();

View file

@ -42,13 +42,13 @@ static void SpinControl_DoSlide(menulist_s *s, int dir);
#define RCOLUMN_OFFSET 16
#define LCOLUMN_OFFSET -16
extern refexport_t re;
//extern refexport_t re;
extern viddef_t viddef;
#define VID_WIDTH viddef.width
#define VID_HEIGHT viddef.height
#define Draw_Char re.DrawChar
#define Draw_Fill re.DrawFill
//#define Draw_Char re.DrawChar
//#define Draw_Fill re.DrawFill
void
Action_DoEnter(menuaction_s *a)

View file

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

View file

@ -285,8 +285,6 @@ extern unsigned d_8to24table[256];
extern int registration_sequence;
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_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 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_SetPalette(const unsigned char *palette);
int Draw_GetPalette(void);
@ -425,7 +412,6 @@ extern glstate_t gl_state;
extern refimport_t ri;
void GLimp_BeginFrame(float camera_separation);
void GLimp_EndFrame(void);
int GLimp_Init(void);
void GLimp_Shutdown(void);
int GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen);

View file

@ -29,13 +29,7 @@
#define NUM_BEAM_SEGS 6
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_Char(int x, int y, int c);
@ -1579,14 +1573,15 @@ R_DrawBeam(entity_t *e)
qglDepthMask(GL_TRUE);
}
refexport_t
//refexport_t
void *
R_GetRefAPI(refimport_t rimp)
{
refexport_t re;
//refexport_t re;
ri = rimp;
re.api_version = API_VERSION;
/*re.api_version = API_VERSION;
re.BeginRegistration = R_BeginRegistration;
re.RegisterModel = R_RegisterModel;
@ -1614,11 +1609,12 @@ R_GetRefAPI(refimport_t rimp)
re.BeginFrame = R_BeginFrame;
re.EndFrame = GLimp_EndFrame;
re.AppActivate = NULL;
re.AppActivate = NULL;*/
Swap_Init();
return re;
//return re;
return NULL;
}
/*