瀏覽代碼

MD3 stuff builds without errors

Thomas Buck 11 年之前
父節點
當前提交
cc3657f4b8
共有 6 個文件被更改,包括 38 次插入39 次删除
  1. 1
    1
      src/Md3.cpp
  2. 2
    2
      src/Md3AnimModel.cpp
  3. 33
    33
      src/Md3AnimModel.h
  4. 1
    1
      src/Render.cpp
  5. 1
    0
      src/SDLSystem.cpp
  6. 0
    2
      src/System.cpp

+ 1
- 1
src/Md3.cpp 查看文件

567
 				unsigned char lat, lng;
567
 				unsigned char lat, lng;
568
 
568
 
569
 
569
 
570
-				normal = (unsigned short)m_meshes[i].vertex[j].st;
570
+				normal = *((unsigned short *)m_meshes[i].vertex[j].st);
571
 				lat = (unsigned char)((normal & 255) * (2 * M_PI) / 255.0);
571
 				lat = (unsigned char)((normal & 255) * (2 * M_PI) / 255.0);
572
 				lng = (unsigned char)(((normal >> 8) & 255) * (2 * M_PI) / 255.0);
572
 				lng = (unsigned char)(((normal >> 8) & 255) * (2 * M_PI) / 255.0);
573
 
573
 

+ 2
- 2
src/Md3AnimModel.cpp 查看文件

315
 }
315
 }
316
 
316
 
317
 
317
 
318
-int Md3AnimModel::loadWeapon(char *modelPath, char *name)
318
+int Md3AnimModel::loadWeapon(char *modelPath, const char *name)
319
 {
319
 {
320
 	int err = 0;
320
 	int err = 0;
321
 
321
 
857
 }
857
 }
858
 
858
 
859
 
859
 
860
-int Md3AnimModel::loadMd3(Md3 &model, char *base, char *modelPath, char *skin,
860
+int Md3AnimModel::loadMd3(Md3 &model, const char *base, char *modelPath, char *skin,
861
 								  md3_lod_t modelLoD)
861
 								  md3_lod_t modelLoD)
862
 {
862
 {
863
 	char filename[256];
863
 	char filename[256];

+ 33
- 33
src/Md3AnimModel.h 查看文件

1
 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
1
 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
 /*================================================================
2
 /*================================================================
3
- * 
3
+ *
4
  * Project : Freyja
4
  * Project : Freyja
5
  * Author  : Terry 'Mongoose' Hendrix II
5
  * Author  : Terry 'Mongoose' Hendrix II
6
  * Website : http://www.westga.edu/~stu7440/
6
  * Website : http://www.westga.edu/~stu7440/
10
  * Comments: Md3 animation model class
10
  * Comments: Md3 animation model class
11
  *
11
  *
12
  *
12
  *
13
- *           This file was generated using Mongoose's C++ 
13
+ *           This file was generated using Mongoose's C++
14
  *           template generator script.  <stu7440@westga.edu>
14
  *           template generator script.  <stu7440@westga.edu>
15
  *
15
  *
16
  *
16
  *
17
  *-- Test Defines -----------------------------------------------
17
  *-- Test Defines -----------------------------------------------
18
- *           
19
- * UNIT_TEST_MD3 - Builds Md3 class as a console unit test 
18
+ *
19
+ * UNIT_TEST_MD3 - Builds Md3 class as a console unit test
20
  *
20
  *
21
  *-- History ----------------------------------------------------
21
  *-- History ----------------------------------------------------
22
  *
22
  *
47
 
47
 
48
 } md3_sex_t;
48
 } md3_sex_t;
49
 
49
 
50
-typedef enum 
50
+typedef enum
51
 {
51
 {
52
 	UNSUPPORTED = -1,
52
 	UNSUPPORTED = -1,
53
 	BOTH_DEATH1 = 0,		// The first twirling death animation
53
 	BOTH_DEATH1 = 0,		// The first twirling death animation
56
 	BOTH_DEAD2,				// The end of the second twirling death animation
56
 	BOTH_DEAD2,				// The end of the second twirling death animation
57
 	BOTH_DEATH3,			// The back flip death animation
57
 	BOTH_DEATH3,			// The back flip death animation
58
 	BOTH_DEAD3,				// The end of the back flip death animation
58
 	BOTH_DEAD3,				// The end of the back flip death animation
59
-	TORSO_GESTURE,			// The torso's gesturing animation	
59
+	TORSO_GESTURE,			// The torso's gesturing animation
60
 	TORSO_ATTACK,			// The torso's attack1 animation
60
 	TORSO_ATTACK,			// The torso's attack1 animation
61
 	TORSO_ATTACK2,			// The torso's attack2 animation
61
 	TORSO_ATTACK2,			// The torso's attack2 animation
62
 	TORSO_DROP,				// The torso's weapon drop animation
62
 	TORSO_DROP,				// The torso's weapon drop animation
122
 
122
 
123
 	Md3AnimModel();
123
 	Md3AnimModel();
124
 	/*------------------------------------------------------
124
 	/*------------------------------------------------------
125
-	 * Pre  : 
125
+	 * Pre  :
126
 	 * Post : Md3AnimModel object is deconstructed
126
 	 * Post : Md3AnimModel object is deconstructed
127
 	 *
127
 	 *
128
 	 *-- History ------------------------------------------
128
 	 *-- History ------------------------------------------
149
 
149
 
150
 	unsigned int getFlags();
150
 	unsigned int getFlags();
151
 	/*------------------------------------------------------
151
 	/*------------------------------------------------------
152
-	 * Pre  : 
152
+	 * Pre  :
153
 	 * Post : Gets option flags
153
 	 * Post : Gets option flags
154
 	 *
154
 	 *
155
 	 *-- History ------------------------------------------
155
 	 *-- History ------------------------------------------
160
 
160
 
161
 	md3_animation_id_t getAnimUpper();
161
 	md3_animation_id_t getAnimUpper();
162
 	/*------------------------------------------------------
162
 	/*------------------------------------------------------
163
-	 * Pre  : 
163
+	 * Pre  :
164
 	 * Post : Get animation for upper model
164
 	 * Post : Get animation for upper model
165
 	 *
165
 	 *
166
 	 *-- History ------------------------------------------
166
 	 *-- History ------------------------------------------
171
 
171
 
172
 	md3_animation_id_t getAnimLower();
172
 	md3_animation_id_t getAnimLower();
173
 	/*------------------------------------------------------
173
 	/*------------------------------------------------------
174
-	 * Pre  : 
174
+	 * Pre  :
175
 	 * Post : Get animation for lower model
175
 	 * Post : Get animation for lower model
176
 	 *
176
 	 *
177
 	 *-- History ------------------------------------------
177
 	 *-- History ------------------------------------------
187
 
187
 
188
 	void setFlag(Md3AnimModelFlags flag);
188
 	void setFlag(Md3AnimModelFlags flag);
189
 	/*------------------------------------------------------
189
 	/*------------------------------------------------------
190
-	 * Pre  : 
190
+	 * Pre  :
191
 	 * Post : Sets option flag
191
 	 * Post : Sets option flag
192
 	 *
192
 	 *
193
 	 *-- History ------------------------------------------
193
 	 *-- History ------------------------------------------
198
 
198
 
199
 	void toggleFlag(Md3AnimModelFlags flag);
199
 	void toggleFlag(Md3AnimModelFlags flag);
200
 	/*------------------------------------------------------
200
 	/*------------------------------------------------------
201
-	 * Pre  : 
201
+	 * Pre  :
202
 	 * Post : Clear/Set option flag
202
 	 * Post : Clear/Set option flag
203
 	 *
203
 	 *
204
 	 *-- History ------------------------------------------
204
 	 *-- History ------------------------------------------
209
 
209
 
210
 	void setAnimUpper(md3_animation_id_t anim);
210
 	void setAnimUpper(md3_animation_id_t anim);
211
 	/*------------------------------------------------------
211
 	/*------------------------------------------------------
212
-	 * Pre  : 
212
+	 * Pre  :
213
 	 * Post : Animation is set for upper model
213
 	 * Post : Animation is set for upper model
214
 	 *
214
 	 *
215
 	 *-- History ------------------------------------------
215
 	 *-- History ------------------------------------------
220
 
220
 
221
 	void setAnimLower(md3_animation_id_t anim);
221
 	void setAnimLower(md3_animation_id_t anim);
222
 	/*------------------------------------------------------
222
 	/*------------------------------------------------------
223
-	 * Pre  : 
223
+	 * Pre  :
224
 	 * Post : Animation is set for lower model
224
 	 * Post : Animation is set for lower model
225
 	 *
225
 	 *
226
 	 *-- History ------------------------------------------
226
 	 *-- History ------------------------------------------
231
 
231
 
232
 	void setDebug(unsigned char level);
232
 	void setDebug(unsigned char level);
233
 	/*------------------------------------------------------
233
 	/*------------------------------------------------------
234
-	 * Pre  : 
234
+	 * Pre  :
235
 	 * Post : level 0 = errors, 1 = warnings, 2 = debug1
235
 	 * Post : level 0 = errors, 1 = warnings, 2 = debug1
236
 	 *
236
 	 *
237
 	 *-- History ------------------------------------------
237
 	 *-- History ------------------------------------------
250
 	 *
250
 	 *
251
 	 *           eg 'default' or 'red' or 'blue' etc
251
 	 *           eg 'default' or 'red' or 'blue' etc
252
 	 *
252
 	 *
253
-	 *        modelLoD - Level of detail to use, 
253
+	 *        modelLoD - Level of detail to use,
254
 	 *
254
 	 *
255
 	 * Post : Error code is returned, 0 no error
255
 	 * Post : Error code is returned, 0 no error
256
 	 *        Md3s are read into memory
256
 	 *        Md3s are read into memory
258
 	 *-- History ------------------------------------------
258
 	 *-- History ------------------------------------------
259
 	 *
259
 	 *
260
 	 *
260
 	 *
261
-	 * 2002.12.29: 
261
+	 * 2002.12.29:
262
 	 * Mongoose - Progressively loads lower LoDs if it can't
262
 	 * Mongoose - Progressively loads lower LoDs if it can't
263
-	 *            find passed LoD 
263
+	 *            find passed LoD
264
 	 *
264
 	 *
265
 	 * 2002.06.19:
265
 	 * 2002.06.19:
266
 	 * Mongoose - Created
266
 	 * Mongoose - Created
268
 
268
 
269
 	int loadAnimations(char *modelPath);
269
 	int loadAnimations(char *modelPath);
270
 	/*------------------------------------------------------
270
 	/*------------------------------------------------------
271
-	 * Pre  : 
271
+	 * Pre  :
272
 	 * Post : Loads animations for composite model
272
 	 * Post : Loads animations for composite model
273
 	 *
273
 	 *
274
 	 *-- History ------------------------------------------
274
 	 *-- History ------------------------------------------
277
 	 * Mongoose - Created
277
 	 * Mongoose - Created
278
 	 ------------------------------------------------------*/
278
 	 ------------------------------------------------------*/
279
 
279
 
280
-	int loadWeapon(char *modelPath, char *name);
280
+	int loadWeapon(char *modelPath, const char *name);
281
 	/*------------------------------------------------------
281
 	/*------------------------------------------------------
282
-	 * Pre  : 
282
+	 * Pre  :
283
 	 * Post : Loads a weapon model
283
 	 * Post : Loads a weapon model
284
 	 *
284
 	 *
285
 	 *-- History ------------------------------------------
285
 	 *-- History ------------------------------------------
340
 
340
 
341
 	void setCurrentTime(Md3 &model);
341
 	void setCurrentTime(Md3 &model);
342
 	/*------------------------------------------------------
342
 	/*------------------------------------------------------
343
-	 * Pre  : 
343
+	 * Pre  :
344
 	 * Post : time is set for model animation
344
 	 * Post : time is set for model animation
345
 	 *
345
 	 *
346
 	 *-- History ------------------------------------------
346
 	 *-- History ------------------------------------------
351
 
351
 
352
 	void updateModel(Md3 &model);
352
 	void updateModel(Md3 &model);
353
 	/*------------------------------------------------------
353
 	/*------------------------------------------------------
354
-	 * Pre  : 
354
+	 * Pre  :
355
 	 * Post : Sets up md3 for next render pass
355
 	 * Post : Sets up md3 for next render pass
356
 	 *
356
 	 *
357
 	 *-- History ------------------------------------------
357
 	 *-- History ------------------------------------------
362
 
362
 
363
 	void initMd3(Md3 &model, unsigned int id);
363
 	void initMd3(Md3 &model, unsigned int id);
364
 	/*------------------------------------------------------
364
 	/*------------------------------------------------------
365
-	 * Pre  : 
365
+	 * Pre  :
366
 	 * Post : Sets up md3 init animation values
366
 	 * Post : Sets up md3 init animation values
367
 	 *
367
 	 *
368
 	 *-- History ------------------------------------------
368
 	 *-- History ------------------------------------------
371
 	 * Mongoose - Created, obsoletes old anim arrays
371
 	 * Mongoose - Created, obsoletes old anim arrays
372
 	 ------------------------------------------------------*/
372
 	 ------------------------------------------------------*/
373
 
373
 
374
-	int addAnim(char *modelPath, md3_animation_id_t id, 
375
-					unsigned int firstFrame, unsigned int numFrames, 
374
+	int addAnim(char *modelPath, md3_animation_id_t id,
375
+					unsigned int firstFrame, unsigned int numFrames,
376
 					unsigned int loopingFrames, unsigned int framesPerSecond);
376
 					unsigned int loopingFrames, unsigned int framesPerSecond);
377
 	/*------------------------------------------------------
377
 	/*------------------------------------------------------
378
-	 * Pre  : 
378
+	 * Pre  :
379
 	 * Post : Sets up animation array
379
 	 * Post : Sets up animation array
380
 	 *
380
 	 *
381
 	 *-- History ------------------------------------------
381
 	 *-- History ------------------------------------------
384
 	 * Mongoose - Created, forked off load()
384
 	 * Mongoose - Created, forked off load()
385
 	 ------------------------------------------------------*/
385
 	 ------------------------------------------------------*/
386
 
386
 
387
-	int loadMd3(Md3 &model, char *base, char *modelPath, char *skin, 
387
+	int loadMd3(Md3 &model, const char *base, char *modelPath, char *skin,
388
 					md3_lod_t modelLoD);
388
 					md3_lod_t modelLoD);
389
 	/*------------------------------------------------------
389
 	/*------------------------------------------------------
390
-	 * Pre  : 
390
+	 * Pre  :
391
 	 * Post : Loads model and if given skin
391
 	 * Post : Loads model and if given skin
392
 	 *
392
 	 *
393
 	 *-- History ------------------------------------------
393
 	 *-- History ------------------------------------------
398
 
398
 
399
 	int loadSkin(Md3 &model, char *filename);
399
 	int loadSkin(Md3 &model, char *filename);
400
 	/*------------------------------------------------------
400
 	/*------------------------------------------------------
401
-	 * Pre  : 
401
+	 * Pre  :
402
 	 * Post : Loads skin for model
402
 	 * Post : Loads skin for model
403
 	 *
403
 	 *
404
 	 *-- History ------------------------------------------
404
 	 *-- History ------------------------------------------
409
 
409
 
410
 	int loadShader(Md3 &model, char *filename);
410
 	int loadShader(Md3 &model, char *filename);
411
 	/*------------------------------------------------------
411
 	/*------------------------------------------------------
412
-	 * Pre  : 
412
+	 * Pre  :
413
 	 * Post : Loads shader for model
413
 	 * Post : Loads shader for model
414
 	 *
414
 	 *
415
 	 *-- History ------------------------------------------
415
 	 *-- History ------------------------------------------
420
 
420
 
421
 	void connectModels(char *tagName, Md3 &modelA, Md3 &modelB);
421
 	void connectModels(char *tagName, Md3 &modelA, Md3 &modelB);
422
 	/*------------------------------------------------------
422
 	/*------------------------------------------------------
423
-	 * Pre  : 
423
+	 * Pre  :
424
 	 * Post : Connects models as A slave to B master
424
 	 * Post : Connects models as A slave to B master
425
 	 *
425
 	 *
426
 	 *-- History ------------------------------------------
426
 	 *-- History ------------------------------------------
431
 
431
 
432
 	int cacheTexture(char *texture);
432
 	int cacheTexture(char *texture);
433
 	/*------------------------------------------------------
433
 	/*------------------------------------------------------
434
-	 * Pre  : 
434
+	 * Pre  :
435
 	 * Post : Sets up texture filename caching
435
 	 * Post : Sets up texture filename caching
436
 	 *
436
 	 *
437
 	 *-- History ------------------------------------------
437
 	 *-- History ------------------------------------------

+ 1
- 1
src/Render.cpp 查看文件

372
 		{
372
 		{
373
 			snprintf(filename, 255, "data/%s", gMd3.texTest[i].name);
373
 			snprintf(filename, 255, "data/%s", gMd3.texTest[i].name);
374
 
374
 
375
-			gMd3.texTest[i].gl_texture_id = mTexture.loadTGA(filename, true);
375
+			gMd3.texTest[i].gl_texture_id = mTexture.loadTGA(filename);
376
 
376
 
377
 			if (gMd3.texTest[i].gl_texture_id < 0)
377
 			if (gMd3.texTest[i].gl_texture_id < 0)
378
 			{
378
 			{

+ 1
- 0
src/SDLSystem.cpp 查看文件

131
 	gWidth = &m_width;
131
 	gWidth = &m_width;
132
 	gHeight = &m_height;
132
 	gHeight = &m_height;
133
     mFirstMouseEvent = false;
133
     mFirstMouseEvent = false;
134
+    mFullscreen = false;
134
 }
135
 }
135
 
136
 
136
 
137
 

+ 0
- 2
src/System.cpp 查看文件

65
 
65
 
66
 	mConsoleMode = false;
66
 	mConsoleMode = false;
67
 
67
 
68
-    mFullscreen = false;
69
-
70
 	printf("[System.Core]\n");
68
 	printf("[System.Core]\n");
71
 
69
 
72
 	// Hack for bad Map class, as well as reserved commands
70
 	// Hack for bad Map class, as well as reserved commands

Loading…
取消
儲存