openmohaa/code/tiki/tiki_surface.cpp

65 lines
1.7 KiB
C++
Raw Normal View History

2016-03-27 11:49:47 +02:00
/*
===========================================================================
2023-11-06 18:08:21 +01:00
Copyright (C) 2023 the OpenMoHAA team
2016-03-27 11:49:47 +02:00
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// tiki_surface.cpp : TIKI surface
#include "q_shared.h"
#include "qcommon.h"
#include <tiki.h>
2016-03-27 11:49:47 +02:00
/*
===============
TIKI_Surface_NameToNum
===============
*/
2023-11-06 18:08:21 +01:00
int TIKI_Surface_NameToNum(dtiki_t *pmdl, const char *name)
2016-03-27 11:49:47 +02:00
{
2023-11-06 18:08:21 +01:00
int i;
dtikisurface_t *psurface;
2016-03-27 11:49:47 +02:00
2023-11-06 18:08:21 +01:00
for (i = 0; i < pmdl->num_surfaces; i++) {
psurface = &pmdl->surfaces[i];
2016-03-27 11:49:47 +02:00
2023-11-06 18:08:21 +01:00
if (!stricmp(psurface->name, name)) {
return i;
}
}
2016-03-27 11:49:47 +02:00
2023-11-06 18:08:21 +01:00
return -1;
2016-03-27 11:49:47 +02:00
}
/*
===============
TIKI_Surface_NumToName
===============
*/
2023-11-06 18:08:21 +01:00
const char *TIKI_Surface_NumToName(dtiki_t *pmdl, int num)
2016-03-27 11:49:47 +02:00
{
2023-11-06 18:08:21 +01:00
if (num < 0 || num >= pmdl->num_surfaces) {
TIKI_Error("TIKI_Surface_NumToName: Surface %d out of range for %s.\n", num, pmdl->a->name);
return NULL;
}
2016-03-27 11:49:47 +02:00
2023-11-06 18:08:21 +01:00
assert(pmdl->surfaces[num].name[0]);
return pmdl->surfaces[num].name;
2016-03-27 11:49:47 +02:00
}