diff --git a/src/client/refresh/files/pcx.c b/src/client/refresh/files/pcx.c index 89eb07b6..b09602b1 100644 --- a/src/client/refresh/files/pcx.c +++ b/src/client/refresh/files/pcx.c @@ -327,7 +327,8 @@ GetPCXPalette (byte **colormap, unsigned *d_8to24table) LoadPCX ("pics/colormap.pcx", colormap, &pal, NULL, NULL); if (!*colormap || !pal) { - ri.Sys_Error (ERR_FATAL, "Couldn't load pics/colormap.pcx"); + ri.Sys_Error (ERR_FATAL, "%s: Couldn't load pics/colormap.pcx", + __func__); } for (i=0 ; i<256 ; i++) diff --git a/src/client/refresh/gl1/gl1_draw.c b/src/client/refresh/gl1/gl1_draw.c index 082bbceb..a6bc1d93 100644 --- a/src/client/refresh/gl1/gl1_draw.c +++ b/src/client/refresh/gl1/gl1_draw.c @@ -40,7 +40,8 @@ Draw_InitLocal(void) draw_chars = FindPic("conchars", (findimage_t)R_FindImageUnsafe); if (!draw_chars) { - ri.Sys_Error(ERR_FATAL, "Couldn't load pics/conchars.pcx"); + ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars.pcx", + __func__); } } diff --git a/src/client/refresh/gl1/gl1_image.c b/src/client/refresh/gl1/gl1_image.c index 838d1741..a6805a41 100644 --- a/src/client/refresh/gl1/gl1_image.c +++ b/src/client/refresh/gl1/gl1_image.c @@ -1206,7 +1206,8 @@ R_InitImages(void) if (!gl_state.d_16to8table) { - ri.Sys_Error(ERR_FATAL, "Couldn't load pics/16to8.pcx"); + ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/16to8.pcx", + __func__); } } diff --git a/src/client/refresh/gl1/gl1_main.c b/src/client/refresh/gl1/gl1_main.c index 670854a1..f1cb7a6b 100644 --- a/src/client/refresh/gl1/gl1_main.c +++ b/src/client/refresh/gl1/gl1_main.c @@ -184,6 +184,7 @@ R_DrawSpriteModel(entity_t *currententity, const model_t *currentmodel) dsprframe_t *frame; float *up, *right; dsprite_t *psprite; + image_t *skin; /* don't even bother culling, because it's just a single polygon without a surface cache */ @@ -208,7 +209,13 @@ R_DrawSpriteModel(entity_t *currententity, const model_t *currentmodel) glColor4f(1, 1, 1, alpha); - R_Bind(currentmodel->skins[currententity->frame]->texnum); + skin = currentmodel->skins[currententity->frame]; + if (!skin) + { + skin = r_notexture; /* fallback... */ + } + + R_Bind(skin->texnum); R_TexEnv(GL_MODULATE); diff --git a/src/client/refresh/gl1/gl1_model.c b/src/client/refresh/gl1/gl1_model.c index f98f6147..0eb5266a 100644 --- a/src/client/refresh/gl1/gl1_model.c +++ b/src/client/refresh/gl1/gl1_model.c @@ -250,7 +250,7 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash) { mod->extradata = Mod_LoadMD2(mod->name, buf, modfilelen, mod->mins, mod->maxs, - (struct image_s **)mod->skins, (findimage_t)R_FindImage, + (struct image_s **)mod->skins, (findimage_t)R_FindImageUnsafe, &(mod->type)); if (!mod->extradata) { @@ -263,7 +263,7 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash) case IDSPRITEHEADER: { mod->extradata = Mod_LoadSP2(mod->name, buf, modfilelen, - (struct image_s **)mod->skins, (findimage_t)R_FindImage, + (struct image_s **)mod->skins, (findimage_t)R_FindImageUnsafe, &(mod->type)); if (!mod->extradata) { @@ -490,7 +490,8 @@ Mod_LoadTexinfo(model_t *loadmodel, byte *mod_base, lump_t *l) if (!image) { - R_Printf(PRINT_ALL, "Couldn't load %s\n", in->texture); + R_Printf(PRINT_ALL, "%s: Couldn't load %s\n", + __func__, in->texture); image = r_notexture; } diff --git a/src/client/refresh/gl3/gl3_draw.c b/src/client/refresh/gl3/gl3_draw.c index 53c06fc3..e6622d27 100644 --- a/src/client/refresh/gl3/gl3_draw.c +++ b/src/client/refresh/gl3/gl3_draw.c @@ -40,7 +40,8 @@ GL3_Draw_InitLocal(void) draw_chars = FindPic("conchars", (findimage_t)GL3_FindImageUnsafe); if (!draw_chars) { - ri.Sys_Error(ERR_FATAL, "Couldn't load pics/conchars.pcx"); + ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars.pcx", + __func__); } // set up attribute layout for 2D textured rendering diff --git a/src/client/refresh/gl3/gl3_main.c b/src/client/refresh/gl3/gl3_main.c index eb819871..bc2d1d64 100644 --- a/src/client/refresh/gl3/gl3_main.c +++ b/src/client/refresh/gl3/gl3_main.c @@ -819,6 +819,7 @@ GL3_DrawSpriteModel(entity_t *e, gl3model_t *currentmodel) dsprframe_t *frame; float *up, *right; dsprite_t *psprite; + gl3image_t *skin; /* don't even bother culling, because it's just a single polygon without a surface cache */ @@ -842,7 +843,13 @@ GL3_DrawSpriteModel(entity_t *e, gl3model_t *currentmodel) GL3_UpdateUBO3D(); } - GL3_Bind(currentmodel->skins[e->frame]->texnum); + skin = currentmodel->skins[e->frame]; + if (!skin) + { + skin = gl3_notexture; /* fallback... */ + } + + GL3_Bind(skin->texnum); if (alpha == 1.0) { diff --git a/src/client/refresh/gl3/gl3_model.c b/src/client/refresh/gl3/gl3_model.c index 8e3f8a72..f05cc4a0 100644 --- a/src/client/refresh/gl3/gl3_model.c +++ b/src/client/refresh/gl3/gl3_model.c @@ -357,7 +357,8 @@ Mod_LoadTexinfo(gl3model_t *loadmodel, byte *mod_base, lump_t *l) image = GetTexImage(in->texture, (findimage_t)GL3_FindImageUnsafe); if (!image) { - R_Printf(PRINT_ALL, "Couldn't load %s\n", in->texture); + R_Printf(PRINT_ALL, "%s: Couldn't load %s\n", + __func__, in->texture); image = gl3_notexture; } @@ -1043,7 +1044,7 @@ Mod_ForName (char *name, gl3model_t *parent_model, qboolean crash) { mod->extradata = Mod_LoadMD2(mod->name, buf, modfilelen, mod->mins, mod->maxs, - (struct image_s **)mod->skins, (findimage_t)GL3_FindImage, + (struct image_s **)mod->skins, (findimage_t)GL3_FindImageUnsafe, &(mod->type)); if (!mod->extradata) { @@ -1056,7 +1057,7 @@ Mod_ForName (char *name, gl3model_t *parent_model, qboolean crash) case IDSPRITEHEADER: { mod->extradata = Mod_LoadSP2(mod->name, buf, modfilelen, - (struct image_s **)mod->skins, (findimage_t)GL3_FindImage, + (struct image_s **)mod->skins, (findimage_t)GL3_FindImageUnsafe, &(mod->type)); if (!mod->extradata) { diff --git a/src/client/refresh/gl3/gl3_sdl.c b/src/client/refresh/gl3/gl3_sdl.c index 10cafd04..bfd83b85 100644 --- a/src/client/refresh/gl3/gl3_sdl.c +++ b/src/client/refresh/gl3/gl3_sdl.c @@ -190,13 +190,15 @@ int GL3_PrepareForWindow(void) { if (libgl == NULL) { - ri.Sys_Error(ERR_FATAL, "Couldn't load libGL: %s!", SDL_GetError()); + ri.Sys_Error(ERR_FATAL, "%s: Couldn't load libGL: %s!", + __func__, SDL_GetError()); return -1; } else { - R_Printf(PRINT_ALL, "Couldn't load libGL: %s!\n", SDL_GetError()); + R_Printf(PRINT_ALL, "%s: Couldn't load libGL: %s!\n", + __func__, SDL_GetError()); R_Printf(PRINT_ALL, "Retrying with default...\n"); ri.Cvar_Set("gl3_libgl", ""); diff --git a/src/client/refresh/soft/sw_alias.c b/src/client/refresh/soft/sw_alias.c index 2ad31285..6e3590fa 100644 --- a/src/client/refresh/soft/sw_alias.c +++ b/src/client/refresh/soft/sw_alias.c @@ -504,7 +504,9 @@ R_AliasSetupSkin(const entity_t *currententity, const model_t *currentmodel) image_t *pskindesc; if (currententity->skin) + { pskindesc = currententity->skin; + } else { int skinnum; diff --git a/src/client/refresh/soft/sw_model.c b/src/client/refresh/soft/sw_model.c index 7673863b..7ee0b0a5 100644 --- a/src/client/refresh/soft/sw_model.c +++ b/src/client/refresh/soft/sw_model.c @@ -200,7 +200,7 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash) { mod->extradata = Mod_LoadMD2(mod->name, buf, modfilelen, mod->mins, mod->maxs, - (struct image_s **)mod->skins, (findimage_t)R_FindImage, + (struct image_s **)mod->skins, (findimage_t)R_FindImageUnsafe, &(mod->type)); if (!mod->extradata) { @@ -213,7 +213,7 @@ Mod_ForName (char *name, model_t *parent_model, qboolean crash) case IDSPRITEHEADER: { mod->extradata = Mod_LoadSP2(mod->name, buf, modfilelen, - (struct image_s **)mod->skins, (findimage_t)R_FindImage, + (struct image_s **)mod->skins, (findimage_t)R_FindImageUnsafe, &(mod->type)); if (!mod->extradata) { @@ -534,9 +534,8 @@ Mod_LoadTexinfo (model_t *loadmodel, byte *mod_base, lump_t *l) image = GetTexImage(in->texture, (findimage_t)R_FindImageUnsafe); if (!image) { - R_Printf(PRINT_ALL, "Couldn't load %s\n", in->texture); + R_Printf(PRINT_ALL, "%s: Couldn't load %s\n", __func__, in->texture); image = r_notexture_mip; - out->flags = 0; } out->image = image; diff --git a/src/client/refresh/soft/sw_sprite.c b/src/client/refresh/soft/sw_sprite.c index 840b8ccf..2a2552cb 100644 --- a/src/client/refresh/soft/sw_sprite.c +++ b/src/client/refresh/soft/sw_sprite.c @@ -39,16 +39,22 @@ R_DrawSprite(entity_t *currententity, const model_t *currentmodel) vec3_t left, up, right, down; dsprite_t *s_psprite; dsprframe_t *s_psprframe; - + image_t *skin; s_psprite = (dsprite_t *)currentmodel->extradata; currententity->frame %= s_psprite->numframes; s_psprframe = &s_psprite->frames[currententity->frame]; - r_polydesc.pixels = currentmodel->skins[currententity->frame]->pixels[0]; - r_polydesc.pixel_width = s_psprframe->width; - r_polydesc.pixel_height = s_psprframe->height; + skin = currentmodel->skins[currententity->frame]; + if (!skin) + { + skin = r_notexture_mip; + } + + r_polydesc.pixels = skin->pixels[0]; + r_polydesc.pixel_width = min(s_psprframe->width, skin->width); + r_polydesc.pixel_height = min(s_psprframe->height, skin->height); r_polydesc.dist = 0; // generate the sprite's axes, completely parallel to the viewplane.