MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DemoReadObjCreate

Function DemoReadObjCreate

Descent3/demofile.cpp:1100–1151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1098}
1099
1100void DemoReadObjCreate() {
1101 // float gametime;
1102 uint8_t type;
1103 uint8_t use_orient;
1104 matrix orient;
1105 vector pos;
1106 int roomnum;
1107 int16_t id;
1108 int parent_handle;
1109 object *obj;
1110
1111 type = cf_ReadByte(Demo_cfp);
1112 use_orient = cf_ReadByte(Demo_cfp);
1113 id = cf_ReadShort(Demo_cfp);
1114 roomnum = cf_ReadInt(Demo_cfp);
1115 gs_ReadVector(Demo_cfp, pos);
1116 parent_handle = cf_ReadInt(Demo_cfp);
1117 if (use_orient)
1118 gs_ReadMatrix(Demo_cfp, orient);
1119 // mprintf(0,"Creating object ype: %d id: %d room: %d\n",type,id,roomnum);
1120
1121 // xlate id to new id.
1122 switch (type) {
1123 case OBJ_ROBOT:
1124 case OBJ_POWERUP:
1125 case OBJ_BUILDING:
1126 case OBJ_CLUTTER:
1127 id = gs_Xlates->obji_indices[id];
1128 break;
1129 case OBJ_CAMERA: // Don't xlate camera IDs
1130 break;
1131 case OBJ_DOOR:
1132 case OBJ_WEAPON:
1133 case OBJ_PLAYER:
1134 Int3(); // Shouldn't be creating these things
1135 break;
1136 default:
1137 Int3(); // What is this?
1138 }
1139
1140 int16_t new_objnum = ObjCreate(type, id, roomnum, &pos, use_orient ? &orient : NULL, parent_handle);
1141 if (new_objnum > -1) { // DAJ -1FIX
1142 obj = &Objects[new_objnum];
1143
1144 int16_t oldobjnum = cf_ReadShort(Demo_cfp);
1145 Demo_obj_map[oldobjnum] = new_objnum;
1146 // MSAFE needs this list too
1147 Server_object_list[oldobjnum] = new_objnum;
1148 InitObjectScripts(obj);
1149 obj->flags |= OF_SERVER_OBJECT;
1150 }
1151}
1152
1153// FrameDemoDelta = FrameCount
1154// DemoFrameCount = 0;

Callers 1

DemoFrameFunction · 0.85

Calls 5

cf_ReadByteFunction · 0.85
cf_ReadShortFunction · 0.85
cf_ReadIntFunction · 0.85
ObjCreateFunction · 0.85
InitObjectScriptsFunction · 0.85

Tested by

no test coverage detected