Skip to content

Commit

Permalink
Add mod_iqm model type enum
Browse files Browse the repository at this point in the history
Add stubs for loading / drawing IQM
Check if model type is IQM for loading
Check if model type is IQM for drawing
  • Loading branch information
blubs committed Jan 8, 2024
1 parent c7a9fd5 commit 2d8c725
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
17 changes: 17 additions & 0 deletions source/psp/video_hardware_iqm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#define IQMHEADER "INTERQUAKEMODEL\0"


/*
=================
Mod_LoadIQMModel
=================
*/
void Mod_LoadIQMModel (model_t *model, void *buffer) {

}



void R_DrawIQMModel(entity_t *currententity) {

}
9 changes: 9 additions & 0 deletions source/psp/video_hardware_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,9 @@ void R_DrawEntitiesOnList (void)
R_DrawAliasModel (currententity);
}

break;
case mod_iqm:
R_DrawIQMModel(currententity);
break;
case mod_md3:
R_DrawQ3Model (currententity);
Expand Down Expand Up @@ -3487,6 +3490,9 @@ void R_DrawViewModel (void)
R_DrawAliasModel (currententity);
r_i_model_transform.value = old_i_model_transform;
break;
case mod_iqm:
R_DrawIQMModel(currententity);
break;
case mod_md3:
R_DrawQ3Model (currententity);
break;
Expand Down Expand Up @@ -3559,6 +3565,9 @@ void R_DrawView2Model (void)
R_DrawAliasModel (currententity);
r_i_model_transform.value = old_i_model_transform;
break;
case mod_iqm:
R_DrawIQMModel(currententity);
break;
case mod_md3:
R_DrawQ3Model (currententity);
break;
Expand Down
15 changes: 11 additions & 4 deletions source/psp/video_hardware_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ void Mod_ClearAll (void)
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{

if (mod->type != mod_alias && mod->type != mod_md3 && mod->type != mod_halflife)
if (mod->type != mod_alias && mod->type != mod_iqm && mod->type != mod_md3 && mod->type != mod_halflife)
{
mod->needload = qtrue;
}

//Models & Sprite Unloading code By Crow_bar
if (mod->type == mod_alias || mod->type == mod_md3 || mod->type == mod_halflife)
if (mod->type == mod_alias || mod->type == mod_iqm || mod->type == mod_md3 || mod->type == mod_halflife)
{
if (Cache_Check (&mod->cache))
Cache_Free (&mod->cache);
Expand Down Expand Up @@ -293,7 +293,7 @@ void Mod_TouchModel (char *name)

mod = Mod_FindName (name);

if (!mod->needload && (mod->type == mod_alias || mod->type == mod_md3 || mod->type == mod_halflife))
if (!mod->needload && (mod->type == mod_alias || mod->type == mod_iqm || mod->type == mod_md3 || mod->type == mod_halflife))
Cache_Check (&mod->cache);

}
Expand All @@ -315,7 +315,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)

if (!mod->needload)
{
if (mod->type == mod_alias || mod->type == mod_md3 || mod->type == mod_halflife)
if (mod->type == mod_alias || mod->type == mod_iqm || mod->type == mod_md3 || mod->type == mod_halflife)
{
d = Cache_Check (&mod->cache);
if (d)
Expand Down Expand Up @@ -387,6 +387,13 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
// call the apropriate loader
mod->needload = qfalse;

// Check if the first few bytes are the IQM header
if(!strcmp( (char*) buf, IQMHEADER)) {
Con_Printf("IQM model loading requested!\n" );
Mod_LoadIQMModel(mod, buf);
return mod;
}

switch (LittleLong(*(unsigned *)buf))
{
case IDPOLYHEADER: //Quake .mdl support
Expand Down
3 changes: 2 additions & 1 deletion source/psp/video_hardware_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ mod_brush,
mod_sprite,
mod_alias,
mod_halflife,
mod_md3
mod_md3,
mod_iqm
}
modtype_t;

Expand Down

0 comments on commit 2d8c725

Please sign in to comment.