Rev 5021 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5021 | Rev 5067 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | extern int32_t g_numEnvSoundsPlaying; |
36 | extern int32_t g_numEnvSoundsPlaying; |
37 | extern int32_t g_noEnemies; |
37 | extern int32_t g_noEnemies; |
38 | 38 | ||
39 | int32_t otherp; |
39 | int32_t otherp; |
40 | 40 | ||
41 | int32_t G_SetInterpolation(int32_t *posptr) |
41 | int32_t G_SetInterpolation(int32_t * const posptr) |
42 | {
|
42 | {
|
43 | int32_t i=g_numInterpolations-1; |
- | |
44 | - | ||
45 | if (g_numInterpolations >= MAXINTERPOLATIONS) |
43 | if (g_numInterpolations >= MAXINTERPOLATIONS) |
46 | return 1; |
44 | return 1; |
47 | 45 | ||
48 | for (; i>=0; i--) |
46 | for (int i = 0; i < g_numInterpolations; ++i) |
49 | if (curipos[i] == posptr) |
47 | if (curipos[i] == posptr) |
50 | return 0; |
48 | return 0; |
51 | 49 | ||
52 | curipos[g_numInterpolations] = posptr; |
50 | curipos[g_numInterpolations] = posptr; |
53 | oldipos[g_numInterpolations] = *posptr; |
51 | oldipos[g_numInterpolations] = *posptr; |
54 | g_numInterpolations++;
|
52 | g_numInterpolations++;
|
55 | return 0; |
53 | return 0; |
56 | }
|
54 | }
|
57 | 55 | ||
58 | void G_StopInterpolation(int32_t *posptr) |
56 | void G_StopInterpolation(int32_t * const posptr) |
59 | {
|
57 | {
|
60 | int32_t i=g_numInterpolations-1; |
- | |
61 | - | ||
62 | for (; i>=startofdynamicinterpolations; i--) |
58 | for (int i = startofdynamicinterpolations; i < g_numInterpolations; ++i) |
63 | if (curipos[i] == posptr) |
59 | if (curipos[i] == posptr) |
64 | {
|
60 | {
|
65 | g_numInterpolations--;
|
61 | g_numInterpolations--;
|
66 | oldipos[i] = oldipos[g_numInterpolations]; |
62 | oldipos[i] = oldipos[g_numInterpolations]; |
67 | bakipos[i] = bakipos[g_numInterpolations]; |
63 | bakipos[i] = bakipos[g_numInterpolations]; |
Line 69... | Line 65... | ||
69 | }
|
65 | }
|
70 | }
|
66 | }
|
71 | 67 | ||
72 | void G_DoInterpolations(int32_t smoothratio) //Stick at beginning of drawscreen |
68 | void G_DoInterpolations(int32_t smoothratio) //Stick at beginning of drawscreen |
73 | {
|
69 | {
|
74 | int32_t i=g_numInterpolations-1, j = 0, odelta, ndelta = 0; |
- | |
75 | - | ||
76 | if (g_interpolationLock++) |
70 | if (g_interpolationLock++) |
77 | {
|
- | |
78 | return; |
71 | return; |
79 | }
|
- | |
80 | 72 | ||
81 | for (; i>=0; i--) |
73 | int32_t odelta, ndelta = 0; |
- | 74 | ||
- | 75 | for (int i = 0, j = 0; i < g_numInterpolations; ++i) |
|
82 | {
|
76 | {
|
83 | bakipos[i] = *curipos[i]; |
- | |
84 | odelta = ndelta; |
77 | odelta = ndelta; |
- | 78 | bakipos[i] = *curipos[i]; |
|
85 | ndelta = (*curipos[i])-oldipos[i]; |
79 | ndelta = (*curipos[i]) - oldipos[i]; |
- | 80 | if (odelta != ndelta) |
|
86 | if (odelta != ndelta) j = mulscale16(ndelta,smoothratio); |
81 | j = mulscale16(ndelta, smoothratio); |
87 | *curipos[i] = oldipos[i]+j; |
82 | *curipos[i] = oldipos[i] + j; |
88 | }
|
83 | }
|
89 | }
|
84 | }
|
90 | 85 | ||
91 | void G_ClearCameraView(DukePlayer_t *ps) |
86 | void G_ClearCameraView(DukePlayer_t *ps) |
92 | {
|
87 | {
|
93 | int32_t k; |
88 | int32_t k; |
94 | 89 | ||
95 | ps->newowner = -1; |
90 | ps->newowner = -1; |
96 | - | ||
97 | ps->pos.x = ps->opos.x; |
- | |
98 | ps->pos.y = ps->opos.y; |
91 | ps->pos = ps->opos; |
99 | ps->pos.z = ps->opos.z; |
- | |
100 | ps->ang = ps->oang; |
92 | ps->ang = ps->oang; |
101 | 93 | ||
102 | updatesector(ps->pos.x, ps->pos.y, &ps->cursectnum); |
94 | updatesector(ps->pos.x, ps->pos.y, &ps->cursectnum); |
103 | P_UpdateScreenPal(ps); |
95 | P_UpdateScreenPal(ps); |
104 | 96 | ||
Line 311... | Line 303... | ||
311 | 303 | ||
312 | // Maybe do a projectile transport via an SE7.
|
304 | // Maybe do a projectile transport via an SE7.
|
313 | // <spritenum>: the projectile
|
305 | // <spritenum>: the projectile
|
314 | // <i>: the SE7
|
306 | // <i>: the SE7
|
315 | // <fromunderp>: below->above change?
|
307 | // <fromunderp>: below->above change?
|
316 | static int32_t Proj_MaybeDoTransport(int32_t spritenum, int32_t i, int32_t fromunderp, int32_t daz) |
308 | static int32_t Proj_MaybeDoTransport(int32_t spritenum, const tspritetype * const effector, int32_t fromunderp, int32_t daz) |
317 | {
|
- | |
318 | if (totalclock > actor[spritenum].lasttransport) |
- | |
319 | {
|
309 | {
|
- | 310 | if (totalclock <= actor[spritenum].lasttransport) |
|
- | 311 | return 0; |
|
- | 312 | ||
320 | spritetype *const spr = &sprite[spritenum]; |
313 | spritetype *const spr = &sprite[spritenum]; |
321 | const spritetype *const otherse = &sprite[OW]; |
314 | const tspritetype *const otherse = (tspritetype *)&sprite[effector->owner]; |
322 | 315 | ||
323 | actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2); |
316 | actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2); |
324 | 317 | ||
325 | spr->x += (otherse->x-SX); |
318 | spr->x += (otherse->x - effector->x); |
326 | spr->y += (otherse->y-SY); |
319 | spr->y += (otherse->y - effector->y); |
327 | if (!fromunderp) // above->below |
- | |
328 | spr->z = sector[otherse->sectnum].ceilingz - daz + sector[sprite[i].sectnum].floorz; |
- | |
329 | else // below->above |
- | |
330 | spr->z = sector[otherse->sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz; |
- | |
331 | 320 | ||
- | 321 | // above->below
|
|
- | 322 | spr->z = (!fromunderp) ? sector[otherse->sectnum].ceilingz - daz + sector[effector->sectnum].floorz : |
|
- | 323 | sector[otherse->sectnum].floorz - daz + sector[effector->sectnum].ceilingz; |
|
- | 324 | // below->above
|
|
- | 325 | ||
332 | Bmemcpy(&actor[spritenum].bpos, &sprite[spritenum], sizeof(vec3_t)); |
326 | actor[spritenum].bpos = *(vec3_t *)&sprite[spritenum]; |
333 | changespritesect(spritenum, otherse->sectnum); |
327 | changespritesect(spritenum, otherse->sectnum); |
334 | 328 | ||
335 | return 1; |
329 | return 1; |
336 | }
|
330 | }
|
337 | 331 | ||
338 | return 0; |
- | |
339 | }
|
- | |
340 | - | ||
341 | // Check whether sprite <s> is on/in a non-SE7 water sector.
|
332 | // Check whether sprite <s> is on/in a non-SE7 water sector.
|
342 | // <othersectptr>: if not NULL, the sector on the other side.
|
333 | // <othersectptr>: if not NULL, the sector on the other side.
|
343 | static int32_t A_CheckNoSE7Water(const spritetype *s, int32_t sectnum, int32_t slotag, int32_t *othersectptr) |
334 | static int32_t A_CheckNoSE7Water(const spritetype *s, int32_t sectnum, int32_t slotag, int32_t *othersectptr) |
344 | {
|
335 | {
|
345 | if (slotag==ST_1_ABOVE_WATER || slotag==ST_2_UNDERWATER) |
336 | if (slotag==ST_1_ABOVE_WATER || slotag==ST_2_UNDERWATER) |
Line 546... | Line 537... | ||
546 | {
|
537 | {
|
547 | const int32_t lotag = sector[dasectnum].lotag; |
538 | const int32_t lotag = sector[dasectnum].lotag; |
548 | 539 | ||
549 | if (lotag == ST_1_ABOVE_WATER) |
540 | if (lotag == ST_1_ABOVE_WATER) |
550 | if (daz >= actor[spritenum].floorz) |
541 | if (daz >= actor[spritenum].floorz) |
551 | if (Proj_MaybeDoTransport(spritenum, i, 0, daz)) |
542 | if (Proj_MaybeDoTransport(spritenum, (tspritetype *)&sprite[i], 0, daz)) |
552 | return 0; |
543 | return 0; |
553 | 544 | ||
554 | if (lotag == ST_2_UNDERWATER) |
545 | if (lotag == ST_2_UNDERWATER) |
555 | if (daz <= actor[spritenum].ceilingz) |
546 | if (daz <= actor[spritenum].ceilingz) |
556 | if (Proj_MaybeDoTransport(spritenum, i, 1, daz)) |
547 | if (Proj_MaybeDoTransport(spritenum, (tspritetype *)&sprite[i], 1, daz)) |
557 | return 0; |
548 | return 0; |
558 | }
|
549 | }
|
559 | }
|
550 | }
|
560 | 551 | ||
561 | return retval; |
552 | return retval; |