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

Function FramePush

Descent3/game.cpp:1126–1165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1124int FrameStackDepth = 0;
1125
1126void FramePush(int x1, int y1, int x2, int y2, bool clear) {
1127 tFrameStackFrame *curr = FrameStackPtr;
1128
1129 if (!curr) {
1130 ASSERT(!FrameStackRoot);
1131
1132 // we need to allocate for the root
1133 // curr = FrameStackRoot = FrameStackPtr = (tFrameStackFrame *)mem_malloc(sizeof(tFrameStackFrame));
1134 curr = FrameStackRoot = FrameStackPtr = &FrameStack[0];
1135 if (!curr) {
1136 Error("Out of memory\n");
1137 }
1138
1139 curr->prev = NULL;
1140 curr->next = NULL;
1141 } else {
1142 // add on to the end of the list
1143 curr->next = FrameStackPtr = &FrameStack[FrameStackDepth];
1144 // curr->next = FrameStackPtr = (tFrameStackFrame *)mem_malloc(sizeof(tFrameStackFrame));
1145 if (!curr->next) {
1146 Error("Out of memory\n");
1147 }
1148 curr->next->prev = curr; // setup previous frame
1149 curr = curr->next;
1150 curr->next = NULL;
1151 }
1152
1153 // at this point curr should be a valid frame, with prev and next set
1154 curr->x1 = x1;
1155 curr->x2 = x2;
1156 curr->y1 = y1;
1157 curr->y2 = y2;
1158 curr->clear = clear;
1159 FrameStackDepth++;
1160 // DAJ
1161 if (FrameStackDepth > 7) {
1162 mprintf(2, "FrameStack Overflow\n");
1163 Int3();
1164 }
1165}
1166
1167void FramePop(int *x1, int *y1, int *x2, int *y2, bool *clear) {
1168 if (!FrameStackRoot || !FrameStackPtr) {

Callers 1

StartFrameFunction · 0.85

Calls 1

ErrorFunction · 0.85

Tested by

no test coverage detected