Reviewed material resolver
All checks were successful
JCS-Prod/RSE-Texture/pipeline/pr-master This commit looks good
JCS-Prod/RSE-Texture/pipeline/head This commit looks good

This commit is contained in:
JackCarterSmith 2022-09-04 13:19:23 +02:00
parent 3ffc546e1e
commit 4e8da870d9
Signed by: JackCarterSmith
GPG Key ID: 832E52F4E23F8F24
7 changed files with 9 additions and 34 deletions

4
.gitignore vendored
View File

@ -15,8 +15,8 @@
# Precompiled Headers
*.gch
*.pch
RSPTerrainLib/src/config.h
RSETerrain/src/config.h
RSPTextureLib/src/config.h
RSETexture/src/config.h
# Libraries
*.lib

View File

@ -20,7 +20,7 @@ if(DEFINED ENV{CI}) # Jenkins CI integration mode
project(rse-texture VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
set(RSE_TEXTURE_NAME $ENV{CI_OUTPUT_NAME})
else() # Standalone project mode, should not be used for release.
project(rse-texture VERSION 2.0.0 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
project(rse-texture VERSION 2.1.0 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
set(RSE_TEXTURE_NAME RSETexture)
endif()
set(RSP_TEXTURE_LIB_NAME RSPTexture${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR})

2
Jenkinsfile vendored
View File

@ -5,7 +5,7 @@ pipeline {
}
environment {
CI_OUTPUT_NAME = "RSETexture"
CI_VERSION = "2.0.1"
CI_VERSION = "2.1.0"
CI_BUILD_NUMBER = "$BUILD_NUMBER"
}
stages {

View File

@ -97,13 +97,11 @@ RSPTEXTURE_EXTERN unsigned short RSPTexture_processHMTFileMemory(
*
* @param[in] pHmt HMT texture structure to be analyzed.
* @param[in] mat_id ID of the material.
* @param[in] mat_type Type of the material.
*
* @return Pointer to T_RSPTEXTURE_MATERIAL if found or NULL otherwise.
*/
RSPTEXTURE_EXTERN T_RSPTEXTURE_MATERIAL* RSPTexture_getMaterialFromID(
const T_RSPTEXTURE_HMT* pHmt, const unsigned short mat_id,
const RSPTEX_MAT_TYPE mat_type
const T_RSPTEXTURE_HMT* pHmt, const unsigned short mat_id
);
RSPTEXTURE_EXTERN char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat );

View File

@ -50,29 +50,11 @@ unsigned short RSPTexture_processHMTFileMemory( T_RSPTEXTURE_HMT* hmtStruct, con
/*
* Material utilities
*/
T_RSPTEXTURE_MATERIAL* RSPTexture_getMaterialFromID( const T_RSPTEXTURE_HMT* pHmt,
const unsigned short mat_id, const RSPTEX_MAT_TYPE mat_type ) {
unsigned int i;
char mat_template_str[17];
T_RSPTEXTURE_MATERIAL* RSPTexture_getMaterialFromID( const T_RSPTEXTURE_HMT* pHmt, const unsigned short mat_id ) {
if ( pHmt == NULL ) return NULL;
if ( pHmt->materials == NULL ) return NULL;
if (mat_type == RSPTEX_MAT_TYPE_SOLID) {
snprintf(mat_template_str, 16, "mat_%d", mat_id);
for ( i = 0; i < pHmt->materials_count; i++ ) {
if (strcmp((char *)pHmt->materials[i].name, mat_template_str) == 0)
return &(pHmt->materials[i]);
}
} else if (mat_type == RSPTEX_MAT_TYPE_TEXTURED) {
for ( i = 0; i < pHmt->materials_count; i++ ) {
if (pHmt->materials[i].id == mat_id && pHmt->materials[i].type == RSPTEX_MAT_TYPE_TEXTURED)
return &(pHmt->materials[i]);
}
}
return NULL;
return &(pHmt->materials[mat_id]);
}
char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat ) {

View File

@ -1,6 +0,0 @@
#ifndef CONFIG_H_
#define CONFIG_H_
#define PRG_VERSION "2.0.0"
#endif /* CONFIG_H_ */

View File

@ -170,7 +170,8 @@ static unsigned short ExtractMaterials(T_RSPTEXTURE_HMT* pHmt, const MEMFILE pMe
if (pParams->verbose_mode) {
printf("[INFO] > Material name: %s\n", pHmt->materials[i].name);
printf("[INFO] > Material type: %d\n", pHmt->materials[i].type);
printf("[INFO] > Material text. index: %d\n", pHmt->materials[i].id);
printf("[INFO] > Material id: %d\n", pHmt->materials[i].id);
printf("[INFO] > Material text. index: %d\n", i);
if (pHmt->materials[i].type == RSPTEX_MAT_TYPE_TEXTURED)
printf("[INFO] > Linked texture name: %s (should correspond to material name)\n", pHmt->materials[i].texture->name);
}