瀏覽代碼

Removed more old stuff from WorldData

Thomas Buck 11 年之前
父節點
當前提交
e10084d735
共有 5 個檔案被更改,包括 15 行新增95 行删除
  1. 6
    29
      include/WorldData.h
  2. 1
    14
      src/Game.cpp
  3. 0
    42
      src/Render.cpp
  4. 6
    1
      src/Room.cpp
  5. 2
    9
      src/World.cpp

+ 6
- 29
include/WorldData.h 查看文件

12
 #include "math/math.h"
12
 #include "math/math.h"
13
 #include "SkeletalModel.h"
13
 #include "SkeletalModel.h"
14
 
14
 
15
-// Mirrors TombRaider class' room flags really
16
 typedef enum {
15
 typedef enum {
17
-    roomFlag_underWater    = 0x0001
18
-} room_flags_t;
19
-
20
-typedef enum {
21
-    worldMoveType_walkNoSwim   = -1,
22
-    worldMoveType_walk         = 0,
23
-    worldMoveType_noClipping   = 1,
24
-    worldMoveType_fly          = 2,
25
-    worldMoveType_swim         = 3
16
+    worldMoveType_walkNoSwim = -1,
17
+    worldMoveType_walk       = 0,
18
+    worldMoveType_noClipping = 1,
19
+    worldMoveType_fly        = 2,
20
+    worldMoveType_swim       = 3
26
 } worldMoveType;
21
 } worldMoveType;
27
 
22
 
28
-typedef struct {
29
-    vec3_t pos;
30
-} vertex_t;
31
-
32
-typedef struct {
33
-    vec2_t st;
34
-} texel_t;
35
-
36
 /*! \fixme For now shaders are textures on tex objects
23
 /*! \fixme For now shaders are textures on tex objects
37
  * and materials on color objects. If -1
24
  * and materials on color objects. If -1
38
  * then it doesn't have that information yet.
25
  * then it doesn't have that information yet.
63
     vec_t *normals;
50
     vec_t *normals;
64
 } model_mesh_t;
51
 } model_mesh_t;
65
 
52
 
66
-typedef struct entity_s {
53
+typedef struct {
67
     int id;                  //!< Unique identifier
54
     int id;                  //!< Unique identifier
68
     float pos[3];            //!< World position
55
     float pos[3];            //!< World position
69
     float angles[3];         //!< Euler angles (pitch, yaw, roll)
56
     float angles[3];         //!< Euler angles (pitch, yaw, roll)
70
-    int type;                //!< {(0x00, item), (0x01, ai), (0x02, player)}
71
     int room;                //!< Current room entity is in
57
     int room;                //!< Current room entity is in
72
     worldMoveType moveType;  //!< Type of motion/clipping
58
     worldMoveType moveType;  //!< Type of motion/clipping
73
-    bool moving;             //!< In motion?
74
-    struct entity_s *master; //!< Part of entity chain?
75
 
59
 
76
     int state;               //!< State of the Player, AI, or object
60
     int state;               //!< State of the Player, AI, or object
77
     int objectId;            //!< What kind of entity?
61
     int objectId;            //!< What kind of entity?
79
     int modelId;             //!< Animation model
63
     int modelId;             //!< Animation model
80
     SkeletalModel *tmpHook;
64
     SkeletalModel *tmpHook;
81
     bool animate;
65
     bool animate;
82
-
83
-    /*
84
-    float time, lastTime;
85
-    int state, lastState;
86
-    int event, lastEvent;
87
-    int goal;
88
-    */
89
 } entity_t;
66
 } entity_t;
90
 
67
 
91
 #endif
68
 #endif

+ 1
- 14
src/Game.cpp 查看文件

447
 
447
 
448
     thing = new entity_t;
448
     thing = new entity_t;
449
     thing->id = (*ent)++;
449
     thing->id = (*ent)++;
450
-    thing->type = 0x00;
451
     thing->pos[0] = item[i].x;
450
     thing->pos[0] = item[i].x;
452
     thing->pos[1] = item[i].y;
451
     thing->pos[1] = item[i].y;
453
     thing->pos[2] = item[i].z;
452
     thing->pos[2] = item[i].z;
454
     thing->angles[1] = yaw;
453
     thing->angles[1] = yaw;
455
     thing->objectId = moveable[index].object_id;
454
     thing->objectId = moveable[index].object_id;
456
-    thing->moving = false;
457
     thing->animate = false;
455
     thing->animate = false;
458
 
456
 
459
     sModel = new SkeletalModel();
457
     sModel = new SkeletalModel();
487
     if (moveable[index].object_id == 0)
485
     if (moveable[index].object_id == 0)
488
     {
486
     {
489
         lara = true;
487
         lara = true;
490
-        thing->type = 0x02;
491
         mLara = thing; // Mongoose 2002.03.22, Cheap hack for now
488
         mLara = thing; // Mongoose 2002.03.22, Cheap hack for now
492
-        mLara->master = 0x0;
493
 
489
 
494
         switch (mTombRaider.Engine())
490
         switch (mTombRaider.Engine())
495
         {
491
         {
855
         r_tri->texture = mTextureOffset + gColorTextureHACK.size();
851
         r_tri->texture = mTextureOffset + gColorTextureHACK.size();
856
 
852
 
857
         getRender().loadTexture(Texture::generateColorTexture(color, 32, 32),
853
         getRender().loadTexture(Texture::generateColorTexture(color, 32, 32),
858
-                32, 32,
859
-                r_tri->texture);
860
-
861
-#ifdef DEBUG_COLOR_TEXTURE_GEN
862
-        printf("Color 0x%02x%02x%02x%02x | 0x%08xto texture[%u]?\n",
863
-                color[0], color[1], color[2], color[3], colorI,
864
-                gColorTextureHACK.size());
865
-#endif
854
+                32, 32, r_tri->texture);
866
     }
855
     }
867
     else
856
     else
868
     {
857
     {
1075
         std::sort(mesh->coloredRectangles.begin(), mesh->coloredRectangles.end(), compareFaceTextureId);
1064
         std::sort(mesh->coloredRectangles.begin(), mesh->coloredRectangles.end(), compareFaceTextureId);
1076
 
1065
 
1077
         getWorld().addMesh(mesh);
1066
         getWorld().addMesh(mesh);
1078
-        //printf(".");
1079
-        //fflush(stdout);
1080
     }
1067
     }
1081
 
1068
 
1082
     printf("Done! Found %d meshes.\n", mTombRaider.getMeshCount());
1069
     printf("Done! Found %d meshes.\n", mTombRaider.getMeshCount());

+ 0
- 42
src/Render.cpp 查看文件

467
             renderTrace(0, u, v); // v = target
467
             renderTrace(0, u, v); // v = target
468
         }
468
         }
469
 
469
 
470
-        entity_t *route = getGame().mLara->master;
471
-
472
-        while (route)
473
-        {
474
-            if (route->master)
475
-            {
476
-                renderTrace(1, route->pos, route->master->pos);
477
-            }
478
-
479
-            route = route->master;
480
-        }
481
-
482
         glEnable(GL_CULL_FACE);
470
         glEnable(GL_CULL_FACE);
483
         glEnable(GL_TEXTURE_2D);
471
         glEnable(GL_TEXTURE_2D);
484
     }
472
     }
751
     // Draw lara or other player model ( move to entity rendering method )
739
     // Draw lara or other player model ( move to entity rendering method )
752
     if (mFlags & Render::fViewModel && getGame().mLara && getGame().mLara->tmpHook)
740
     if (mFlags & Render::fViewModel && getGame().mLara && getGame().mLara->tmpHook)
753
     {
741
     {
754
-        SkeletalModel *mdl = getGame().mLara->tmpHook;
755
-
756
-        if (mdl)
757
-        {
758
-            int frame;
759
-
760
-            // Mongoose 2002.03.22, Test 'idle' aniamtions
761
-            if (!getGame().mLara->moving)
762
-            {
763
-                frame = mdl->getIdleAnimation();
764
-
765
-                // Mongoose 2002.08.15, Stop flickering of idle lara here
766
-                if (frame == 11)
767
-                {
768
-                    mdl->setFrame(0);
769
-                }
770
-            }
771
-            else
772
-            {
773
-                frame = mdl->getAnimation();
774
-            }
775
-
776
-            animation_frame_t *animation = mdl->model->animation[frame];
777
-
778
-            if (animation && mdl->getFrame() > (int)animation->frame.size()-1)
779
-            {
780
-                mdl->setFrame(0);
781
-            }
782
-        }
783
-
784
         glPushMatrix();
742
         glPushMatrix();
785
 
743
 
786
         glTranslated(getGame().mLara->pos[0], getGame().mLara->pos[1], getGame().mLara->pos[2]);
744
         glTranslated(getGame().mLara->pos[0], getGame().mLara->pos[1], getGame().mLara->pos[2]);

+ 6
- 1
src/Room.cpp 查看文件

30
         return;
30
         return;
31
     }
31
     }
32
 
32
 
33
-    tr.getRoomInfo(index, &flags, pos, box[0], box[1]);
33
+    flags = 0;
34
+    unsigned int trFlags = 0;
35
+    tr.getRoomInfo(index, &trFlags, pos, box[0], box[1]);
36
+
37
+    if (trFlags & tombraiderRoom_underWater)
38
+        flags |= RoomFlagUnderWater;
34
 
39
 
35
     // Adjust positioning for OR world coordinate translation
40
     // Adjust positioning for OR world coordinate translation
36
     box[0][0] += pos[0];
41
     box[0][0] += pos[0];

+ 2
- 9
src/World.cpp 查看文件

44
 {
44
 {
45
     if (e)
45
     if (e)
46
     {
46
     {
47
-        e->master = 0x0;
48
         e->moveType = worldMoveType_walk; // Walk
47
         e->moveType = worldMoveType_walk; // Walk
49
         e->room = getRoomByLocation(e->pos[0], e->pos[1], e->pos[2]);
48
         e->room = getRoomByLocation(e->pos[0], e->pos[1], e->pos[2]);
50
         mEntities.push_back(e);
49
         mEntities.push_back(e);
144
 
143
 
145
     // If you're underwater you may want to swim  =)
144
     // If you're underwater you may want to swim  =)
146
     // ...if you're worldMoveType_walkNoSwim, you better hope it's shallow
145
     // ...if you're worldMoveType_walkNoSwim, you better hope it's shallow
147
-    if (roomFlags & roomFlag_underWater && e->moveType == worldMoveType_walk)
148
-    {
146
+    if (roomFlags & RoomFlagUnderWater && e->moveType == worldMoveType_walk)
149
         e->moveType = worldMoveType_swim;
147
         e->moveType = worldMoveType_swim;
150
-    }
151
 
148
 
152
     // Don't swim on land
149
     // Don't swim on land
153
-    if (!(roomFlags & roomFlag_underWater) && e->moveType == worldMoveType_swim)
154
-    {
150
+    if (!(roomFlags & RoomFlagUnderWater) && e->moveType == worldMoveType_swim)
155
         e->moveType = worldMoveType_walk;
151
         e->moveType = worldMoveType_walk;
156
-    }
157
 
152
 
158
     // Mongoose 2002.09.02, Add check for room -> room transition
153
     // Mongoose 2002.09.02, Add check for room -> room transition
159
     //   ( Only allow by movement between rooms by using portals )
154
     //   ( Only allow by movement between rooms by using portals )
234
     }
229
     }
235
     else
230
     else
236
     {
231
     {
237
-        e->moving = false;
238
         return;
232
         return;
239
     }
233
     }
240
 
234
 
241
     e->room = room;
235
     e->room = room;
242
-    e->moving = true;
243
 }
236
 }
244
 
237
 
245
 
238
 

Loading…
取消
儲存