Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // [tm512] P_MakeMobjBuffer
- // Cycle the thinker list, creating an array of bitmasks saying whether the mobj is there anymore or not.
- // Sent to clients upon connect so they can remove items that aren't still on the map.
- uint8_t *P_MakeMobjBuffer (void)
- {
- int i, j;
- thinker_t *current;
- uint8_t *mobjbuf = malloc(MAX_MOBJ_BUFFER);
- current = thinkercap.next;
- i = 1;
- j = 0;
- memset(mobjbuf, 0, sizeof(mobjbuf));
- while (current != &thinkercap)
- {
- if (current->function.acp1 == (actionf_p1)P_MobjThinker)
- {
- if(((mobj_t*)current)->netid == i) // The mobj for "i" is still here
- {
- mobjbuf[j] |= 1 << (i % 8);
- printf("Writing %i to the mobj buffer\n", i);
- current = current->next;
- }
- j += (!(++i % 8));
- if(j == MAX_MOBJ_BUFFER - 1)
- I_Error("P_MakeMobjBuffer: Buffer overflow\n");
- }
- }
- return mobjbuf;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement