halflife-thewastes-sdk/cl_dll/twmmanager.h

67 lines
1.6 KiB
C++

/***
*
* Copyright (C) 2002 The Wastes Project, All Rights Reserved.
*
* This product contains software technology from Valve Software, LLC,
* Copyright © 1996-2001, Valve LLC, All rights reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* The Wastes Project. All other use, distribution, or modification is prohibited
* without written permission from The Wastes Project.
*
***/
#ifndef __TWMMANAGER_H_
#define __TWMMANAGER_H_
// STL stuff
#include <string>
#include <vector>
using namespace std;
class CTwmModel
{
public:
CTwmModel();
~CTwmModel();
string filename;
twm_info_t twminfo;
};
class CTwmManager
{
private:
// all our precached models
vector<CTwmModel*> vecModels;
// Helper functions for PrecacheModel
void ParseVertexLump(FILE *pFile,CTwmModel *pTwmModel);
void ParseTriangleLump(FILE *pFile,CTwmModel *pTwmModel);
void ParseMaterialLump(FILE *pFile,CTwmModel *pTwmModel);
int PrecacheModel(string filename);
public:
CTwmManager();
~CTwmManager();
// Called when we need to load the base .twm's
void BeginPrecache();
// .TWM retrieval operations
CTwmModel *GetModelByName(string filename);
// Update twm info :o
void TwmUpdate(twm_clientinfo_t *clientinfo,double frametime);
};
extern CTwmManager g_TwmManager;
// 3d muzzleflashes
extern twm_clientinfo_t g_MuzzleflashModels[64];
extern int g_iNumMuzzleflashModels;
#define TWM_UPDATE_ARRAY(array,count,frametime) {for(int i = 0;i < count;i++)g_TwmManager.TwmUpdate(&array[i],frametime);}
#endif