* improved quake2 support by added a quake2 boolean to the CGameDescription class - this allows us to even use the quake2 surfaceplugin function (like e.g. SetFaceTexdef_Q2) without a hardcoded game name of q2.game or heretic2.game

* added support for relative md2 skin paths
* fixed wrong _pico_printf call

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@203 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
mattn 2008-03-04 17:33:05 +00:00
parent ec2a5d09b1
commit 8999fcc3a7
4 changed files with 35 additions and 4 deletions

View File

@ -337,9 +337,10 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD )
index_DUP_LUT_t *p_index_LUT_DUPS; index_DUP_LUT_t *p_index_LUT_DUPS;
md2Triangle_t *p_md2Triangle; md2Triangle_t *p_md2Triangle;
char path[ MD2_MAX_SKINNAME ];
char skinname[ MD2_MAX_SKINNAME ]; char skinname[ MD2_MAX_SKINNAME ];
md2_t *md2; md2_t *md2;
md2St_t *texCoord; md2St_t *texCoord;
md2Frame_t *frame; md2Frame_t *frame;
md2Triangle_t *triangle; md2Triangle_t *triangle;
md2XyzNormal_t *vertex; md2XyzNormal_t *vertex;
@ -435,7 +436,24 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD )
strncpy(skinname, (bb + md2->ofsSkins), MD2_MAX_SKINNAME ); strncpy(skinname, (bb + md2->ofsSkins), MD2_MAX_SKINNAME );
// Print out md2 values // Print out md2 values
_pico_printf(PICO_VERBOSE,"Skins: %d Verts: %d STs: %d Triangles: %d Frames: %d\nSkin Name \"%s\"\n", md2->numSkins, md2->numXYZ, md2->numST, md2->numTris, md2->numFrames, &skinname ); _pico_printf(PICO_VERBOSE,"Skins: %d Verts: %d STs: %d Triangles: %d Frames: %d\nSkin Name \"%s\"\n", md2->numSkins, md2->numXYZ, md2->numST, md2->numTris, md2->numFrames, skinname );
// relative texture path - allows moving of models in game dir structure without changing the skinpath
// e.g. used in ufo:ai
if (skinname[0] == '.') {
strncpy(path, fileName, MD2_MAX_SKINNAME);
for (i = MD2_MAX_SKINNAME; i--;) {
// skip filename
if (path[i] == '/' || path[i] == '\\')
break;
path[i] = '\0';
}
strncat(path, &skinname[1], MD2_MAX_SKINNAME);
strncpy(skinname, path, MD2_MAX_SKINNAME);
// Print out md2 values
_pico_printf(PICO_VERBOSE,"Relative skin path converted to: \"%s\" (%s)\n", skinname, fileName );
}
// detox Skin name // detox Skin name
_pico_setfext( skinname, "" ); _pico_setfext( skinname, "" );

View File

@ -746,6 +746,18 @@ CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
mGameFile = GameFile; mGameFile = GameFile;
prop = (char*)xmlGetProp(pNode, (xmlChar*)"quake2");
if (prop == NULL)
{
// default
quake2 = false;
}
else
{
quake2 = true;
xmlFree(prop);
}
prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame"); prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame");
if (prop == NULL) if (prop == NULL)
{ {

View File

@ -180,6 +180,7 @@ public:
bool mEClassSingleLoad; ///< only load a single eclass definition file bool mEClassSingleLoad; ///< only load a single eclass definition file
bool mNoPatch; ///< this game doesn't support patch technology bool mNoPatch; ///< this game doesn't support patch technology
Str mCaulkShader; ///< the shader to use for caulking Str mCaulkShader; ///< the shader to use for caulking
bool quake2; ///< set this to true to get quake2
CGameDescription() { mpDoc = NULL; } CGameDescription() { mpDoc = NULL; }
/*! /*!

View File

@ -168,7 +168,7 @@ void SI_SetTexdef_FaceList(texdef_to_face_t* texdef_face_list, bool b_SetUndoPoi
texdef_to_face_t* texdef_to_face; texdef_to_face_t* texdef_to_face;
bool b_isQuake2; bool b_isQuake2;
if ( ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" ) ) if ( ( g_pGameDescription->quake2 ) || ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" ) )
b_isQuake2 = true; b_isQuake2 = true;
else else
b_isQuake2 = false; b_isQuake2 = false;