From c9190e79ae33818d655716007666520c08a7c8b1 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 19 Jan 2013 18:28:32 +0000 Subject: [PATCH] Wrap some ud.camera* and g_camera{Distance,Clock} into CAMERA* macros. In Lunatic, make it a struct type "camera_t" instead. git-svn-id: https://svn.eduke32.com/eduke32@3405 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 124 ++++++++++++----------- polymer/eduke32/source/game.h | 28 ++++- polymer/eduke32/source/gameexec.c | 8 +- polymer/eduke32/source/gamevars.c | 12 +-- polymer/eduke32/source/lunatic/defs.ilua | 9 +- polymer/eduke32/source/menus.c | 4 +- polymer/eduke32/source/player.c | 2 +- polymer/eduke32/source/savegame.c | 4 +- polymer/eduke32/source/sounds.c | 12 +-- 9 files changed, 117 insertions(+), 86 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 200e4750b..baa3fd8a2 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -89,7 +89,11 @@ static int32_t usecwd = 0; int32_t g_quitDeadline = 0; +#ifdef LUNATIC +camera_t g_camera; +#else int32_t g_cameraDistance = 0, g_cameraClock = 0; +#endif static int32_t g_quickExit; static int32_t g_commandSetup = 0; int32_t g_noSetup = 0; @@ -2833,8 +2837,8 @@ void G_DisplayRest(int32_t smoothratio) { ready2send = 1; totalclock = ototalclock; - g_cameraClock = totalclock; - g_cameraDistance = 65536L; + CAMERACLOCK = totalclock; + CAMERADIST = 65536; } walock[TILE_SAVESHOT] = 199; G_UpdateScreenArea(); @@ -3075,14 +3079,14 @@ static void G_DoThirdPerson(const DukePlayer_t *pp, vec3_t *vect, int16_t *vsect } if (klabs(n.x) > klabs(n.y)) i = divscale16(hx,n.x); else i = divscale16(hy,n.y); - if (i < g_cameraDistance) g_cameraDistance = i; + if (i < CAMERADIST) CAMERADIST = i; } - vect->x += mulscale16(n.x,g_cameraDistance); - vect->y += mulscale16(n.y,g_cameraDistance); - vect->z += mulscale16(n.z,g_cameraDistance); + vect->x += mulscale16(n.x,CAMERADIST); + vect->y += mulscale16(n.y,CAMERADIST); + vect->z += mulscale16(n.z,CAMERADIST); - g_cameraDistance = min(g_cameraDistance+((totalclock-g_cameraClock)<<10),65536); - g_cameraClock = totalclock; + CAMERADIST = min(CAMERADIST+((totalclock-CAMERACLOCK)<<10),65536); + CAMERACLOCK = totalclock; updatesectorz(vect->x,vect->y,vect->z,vsectnum); @@ -3228,9 +3232,9 @@ static void G_SE40(int32_t smoothratio) if (klabs(sector[sp->sectnum].floorz - sp->z) < klabs(sector[sprite[sprite2].sectnum].floorz - sprite[sprite2].z)) level = 1; - x = ud.camera.x - sp->x; - y = ud.camera.y - sp->y; - z = ud.camera.z - (level ? sector[sp->sectnum].floorz : sector[sp->sectnum].ceilingz); + x = CAMERA(pos.x) - sp->x; + y = CAMERA(pos.y) - sp->y; + z = CAMERA(pos.z) - (level ? sector[sp->sectnum].floorz : sector[sp->sectnum].ceilingz); sect = sprite[sprite2].sectnum; updatesector(sprite[sprite2].x + x, sprite[sprite2].y + y, §); @@ -3291,11 +3295,11 @@ static void G_SE40(int32_t smoothratio) #ifdef POLYMER if (getrendermode() == REND_POLYMER) - polymer_setanimatesprites(G_DoSpriteAnimations, ud.camera.x, ud.camera.y, ud.cameraang, smoothratio); + polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x), CAMERA(pos.y), CAMERA(ang), smoothratio); #endif drawrooms(sprite[sprite2].x + x, sprite[sprite2].y + y, - z + renderz, ud.cameraang, ud.camerahoriz, sect); + z + renderz, CAMERA(ang), CAMERA(horiz), sect); drawing_ror = 1 + level; // dupe the sprites touching the portal to the other sector @@ -3323,7 +3327,7 @@ static void G_SE40(int32_t smoothratio) } } - G_DoSpriteAnimations(ud.camera.x,ud.camera.y,ud.cameraang,smoothratio); + G_DoSpriteAnimations(CAMERA(pos.x),CAMERA(pos.y),CAMERA(ang),smoothratio); drawmasks(); if (level) @@ -3472,7 +3476,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) g_visibility = (int32_t)(p->visibility * (numplayers > 1 ? 1.f : r_ambientlightrecip)); - ud.camerasect = p->cursectnum; + CAMERA(sect) = p->cursectnum; G_DoInterpolations(smoothratio); G_AnimateCamSprite(); @@ -3485,19 +3489,19 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) if (s->yvel < 0) s->yvel = -100; else if (s->yvel > 199) s->yvel = 300; - ud.cameraang = actor[ud.camerasprite].tempang + + CAMERA(ang) = actor[ud.camerasprite].tempang + mulscale16(((s->ang+1024-actor[ud.camerasprite].tempang)&2047)-1024, smoothratio); G_SE40(smoothratio); #ifdef POLYMER if (getrendermode() == REND_POLYMER) - polymer_setanimatesprites(G_DoSpriteAnimations, s->x, s->y, ud.cameraang, smoothratio); + polymer_setanimatesprites(G_DoSpriteAnimations, s->x, s->y, CAMERA(ang), smoothratio); #endif yax_preparedrawrooms(); - drawrooms(s->x,s->y,s->z-(4<<8),ud.cameraang,s->yvel,s->sectnum); + drawrooms(s->x,s->y,s->z-(4<<8),CAMERA(ang),s->yvel,s->sectnum); yax_drawrooms(G_DoSpriteAnimations, s->sectnum, 0, smoothratio); - G_DoSpriteAnimations(s->x,s->y,ud.cameraang,smoothratio); + G_DoSpriteAnimations(s->x,s->y,CAMERA(ang),smoothratio); drawmasks(); } else @@ -3606,10 +3610,10 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) p->opos.z+mulscale16(p->pos.z-p->opos.z, smoothratio) }; - Bmemcpy(&ud.camera, &cam, sizeof(vec3_t)); - ud.cameraang = p->oang + mulscale16(((p->ang+1024-p->oang)&2047)-1024, smoothratio); - ud.cameraang += p->look_ang; - ud.camerahoriz = p->ohoriz+p->ohorizoff + Bmemcpy(&CAMERA(pos), &cam, sizeof(vec3_t)); + CAMERA(ang) = p->oang + mulscale16(((p->ang+1024-p->oang)&2047)-1024, smoothratio); + CAMERA(ang) += p->look_ang; + CAMERA(horiz) = p->ohoriz+p->ohorizoff + mulscale16((p->horiz+p->horizoff-p->ohoriz-p->ohorizoff), smoothratio); if (ud.viewbob) @@ -3618,22 +3622,22 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) if (p->over_shoulder_on) addz >>= 3; - ud.camera.z += addz; + CAMERA(pos.z) += addz; } if (p->over_shoulder_on) { - ud.camera.z -= 3072; - G_DoThirdPerson(p,&ud.camera,&ud.camerasect,ud.cameraang,ud.camerahoriz); + CAMERA(pos.z) -= 3072; + G_DoThirdPerson(p,&CAMERA(pos),&CAMERA(sect),CAMERA(ang),CAMERA(horiz)); } } else { // looking through viewscreen - Bmemcpy(&ud.camera, &p->pos, sizeof(vec3_t)); - ud.cameraang = p->ang + p->look_ang; - ud.camerahoriz = 100+sprite[p->newowner].shade; - ud.camerasect = sprite[p->newowner].sectnum; + Bmemcpy(&CAMERA(pos), &p->pos, sizeof(vec3_t)); + CAMERA(ang) = p->ang + p->look_ang; + CAMERA(horiz) = 100+sprite[p->newowner].shade; + CAMERA(sect) = sprite[p->newowner].sectnum; smoothratio = 65536; } @@ -3642,53 +3646,53 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) if (g_earthquakeTime > 0 && p->on_ground == 1) { - ud.camera.z += 256-(((g_earthquakeTime)&1)<<9); - ud.cameraang += (2-((g_earthquakeTime)&2))<<2; + CAMERA(pos.z) += 256-(((g_earthquakeTime)&1)<<9); + CAMERA(ang) += (2-((g_earthquakeTime)&2))<<2; } if (sprite[p->i].pal == 1) - ud.camera.z -= (18<<8); + CAMERA(pos.z) -= (18<<8); if (p->newowner < 0 && p->spritebridge == 0) { // NOTE: when shrunk, p->pos.z can be below the floor. This puts the // camera into the sector again then. - if (ud.camera.z < (p->truecz + (4<<8))) - ud.camera.z = cz + (4<<8); - else if (ud.camera.z > (p->truefz - (4<<8))) - ud.camera.z = fz - (4<<8); + if (CAMERA(pos.z) < (p->truecz + (4<<8))) + CAMERA(pos.z) = cz + (4<<8); + else if (CAMERA(pos.z) > (p->truefz - (4<<8))) + CAMERA(pos.z) = fz - (4<<8); } - while (ud.camerasect >= 0) // if, really + while (CAMERA(sect) >= 0) // if, really { - getzsofslope(ud.camerasect,ud.camera.x,ud.camera.y,&cz,&fz); + getzsofslope(CAMERA(sect),CAMERA(pos.x),CAMERA(pos.y),&cz,&fz); #ifdef YAX_ENABLE - if (yax_getbunch(ud.camerasect, YAX_CEILING) >= 0) + if (yax_getbunch(CAMERA(sect), YAX_CEILING) >= 0) { - if (ud.camera.z < cz) + if (CAMERA(pos.z) < cz) { - updatesectorz(ud.camera.x, ud.camera.y, ud.camera.z, &ud.camerasect); - break; // since ud.camerasect might have been updated to -1 + updatesectorz(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), &CAMERA(sect)); + break; // since CAMERA(sect) might have been updated to -1 // NOTE: fist discovered in WGR2 SVN r134, til' death level 1 // (Lochwood Hollow). A problem REMAINS with Polymost, maybe classic! } } else #endif - if (ud.camera.z < cz+(4<<8)) - ud.camera.z = cz+(4<<8); + if (CAMERA(pos.z) < cz+(4<<8)) + CAMERA(pos.z) = cz+(4<<8); #ifdef YAX_ENABLE - if (yax_getbunch(ud.camerasect, YAX_FLOOR) >= 0) + if (yax_getbunch(CAMERA(sect), YAX_FLOOR) >= 0) { - if (ud.camera.z > fz) - updatesectorz(ud.camera.x, ud.camera.y, ud.camera.z, &ud.camerasect); + if (CAMERA(pos.z) > fz) + updatesectorz(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), &CAMERA(sect)); } else #endif - if (ud.camera.z > fz-(4<<8)) - ud.camera.z = fz-(4<<8); + if (CAMERA(pos.z) > fz-(4<<8)) + CAMERA(pos.z) = fz-(4<<8); break; } @@ -3699,7 +3703,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) if (G_HaveEvent(EVENT_DISPLAYROOMS)) dont_draw = VM_OnEvent(EVENT_DISPLAYROOMS, g_player[screenpeek].ps->i, screenpeek, -1, 0); - ud.camerahoriz = clamp(ud.camerahoriz, HORIZ_MIN, HORIZ_MAX); + CAMERA(horiz) = clamp(CAMERA(horiz), HORIZ_MIN, HORIZ_MAX); if (dont_draw != 1) // event return values other than 0 and 1 are reserved { @@ -3707,21 +3711,21 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMS return value must be 0 or 1, " "other values are reserved.\n"); - G_HandleMirror(ud.camera.x, ud.camera.y, ud.camera.z, ud.cameraang, ud.camerahoriz, smoothratio); + G_HandleMirror(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), CAMERA(ang), CAMERA(horiz), smoothratio); G_SE40(smoothratio); #ifdef POLYMER if (getrendermode() == REND_POLYMER) - polymer_setanimatesprites(G_DoSpriteAnimations, ud.camera.x,ud.camera.y,ud.cameraang,smoothratio); + polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x),CAMERA(pos.y),CAMERA(ang),smoothratio); #endif // for G_PrintCoords dr_viewingrange = viewingrange; dr_yxaspect = yxaspect; yax_preparedrawrooms(); - drawrooms(ud.camera.x,ud.camera.y,ud.camera.z,ud.cameraang,ud.camerahoriz,ud.camerasect); - yax_drawrooms(G_DoSpriteAnimations, ud.camerasect, 0, smoothratio); + drawrooms(CAMERA(pos.x),CAMERA(pos.y),CAMERA(pos.z),CAMERA(ang),CAMERA(horiz),CAMERA(sect)); + yax_drawrooms(G_DoSpriteAnimations, CAMERA(sect), 0, smoothratio); // dupe the sprites touching the portal to the other sector @@ -3753,7 +3757,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) } } - G_DoSpriteAnimations(ud.camera.x,ud.camera.y,ud.cameraang,smoothratio); + G_DoSpriteAnimations(CAMERA(pos.x),CAMERA(pos.y),CAMERA(ang),smoothratio); drawing_ror = 0; drawmasks(); @@ -7363,8 +7367,8 @@ FOUNDCHEAT: else { g_player[myconnectindex].ps->over_shoulder_on = 1; - g_cameraDistance = 0; - g_cameraClock = totalclock; + CAMERADIST = 0; + CAMERACLOCK = totalclock; } // P_DoQuote(QUOTE_CHEATS_DISABLED,g_player[myconnectindex].ps); end_cheat(); @@ -7976,8 +7980,8 @@ FAKE_F3: else { g_player[myconnectindex].ps->over_shoulder_on = 1; - g_cameraDistance = 0; - g_cameraClock = totalclock; + CAMERADIST = 0; + CAMERACLOCK = totalclock; } P_DoQuote(QUOTE_VIEW_MODE_OFF+g_player[myconnectindex].ps->over_shoulder_on,g_player[myconnectindex].ps); } diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 144291c30..3e4430035 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -74,8 +74,28 @@ typedef enum basepal_ { void A_DeleteSprite(int32_t s); +#ifdef LUNATIC typedef struct { - vec3_t camera; + vec3_t pos; + int32_t dist, clock; + int16_t ang, horiz, sect; +} camera_t; + +extern camera_t g_camera; + +# define CAMERA(Membname) (g_camera.Membname) +# define CAMERADIST (g_camera.dist) +# define CAMERACLOCK (g_camera.clock) +#else +# define CAMERA(Membname) (ud.camera ## Membname) +# define CAMERADIST g_cameraDistance +# define CAMERACLOCK g_cameraClock +#endif + +typedef struct { +#if !defined LUNATIC + vec3_t camerapos; +#endif int32_t const_visibility,uw_framerate; int32_t camera_time,folfvel,folavel,folx,foly,fola; int32_t reccnt,crosshairscale; @@ -95,8 +115,9 @@ typedef struct { int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip; int32_t configversion; - +#if !defined LUNATIC int16_t cameraang, camerasect, camerahoriz; +#endif int16_t pause_on,from_bonus; int16_t camerasprite,last_camsprite; int16_t last_level,secretlevel, bgstretch; @@ -204,9 +225,10 @@ extern int32_t althud_shadows; extern int32_t cacnum; //extern int32_t drawing_ror; extern int32_t g_Shareware; +#if !defined LUNATIC extern int32_t g_cameraClock; extern int32_t g_cameraDistance; -extern int32_t g_cameraDistance; +#endif extern int32_t g_crosshairSum; extern int32_t g_doQuickSave; extern int32_t g_forceWeaponChoice; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 672bc5dc1..d0d74f4c9 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -935,8 +935,8 @@ static void VM_ResetPlayer(void) { if (vm.g_p == myconnectindex) { - g_cameraDistance = 0; - g_cameraClock = totalclock; + CAMERADIST = 0; + CAMERACLOCK = totalclock; } if (g_fakeMultiMode) @@ -5510,8 +5510,8 @@ void G_RestoreMapState(mapstate_t *save) if (g_player[myconnectindex].ps->over_shoulder_on != 0) { - g_cameraDistance = 0; - g_cameraClock = 0; + CAMERADIST = 0; + CAMERACLOCK = 0; g_player[myconnectindex].ps->over_shoulder_on = 1; } diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 246ce0bd1..5fe511d3e 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -1340,9 +1340,9 @@ static void Gv_AddSystemVars(void) Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY); Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY); - Gv_NewVar("camerax",(intptr_t)&ud.camera.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("cameray",(intptr_t)&ud.camera.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("cameraz",(intptr_t)&ud.camera.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); + Gv_NewVar("camerax",(intptr_t)&ud.camerapos.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); + Gv_NewVar("cameray",(intptr_t)&ud.camerapos.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); + Gv_NewVar("cameraz",(intptr_t)&ud.camerapos.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR); Gv_NewVar("camerahoriz",(intptr_t)&ud.camerahoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR); Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR); @@ -1513,9 +1513,9 @@ void Gv_RefreshPointers(void) aGameVars[Gv_GetVarIndex("gametype_flags")].val.lValue = (intptr_t)&GametypeFlags[ud.coop]; aGameVars[Gv_GetVarIndex("framerate")].val.lValue = (intptr_t)&g_currentFrameRate; - aGameVars[Gv_GetVarIndex("camerax")].val.lValue = (intptr_t)&ud.camera.x; - aGameVars[Gv_GetVarIndex("cameray")].val.lValue = (intptr_t)&ud.camera.y; - aGameVars[Gv_GetVarIndex("cameraz")].val.lValue = (intptr_t)&ud.camera.z; + aGameVars[Gv_GetVarIndex("camerax")].val.lValue = (intptr_t)&ud.camerapos.x; + aGameVars[Gv_GetVarIndex("cameray")].val.lValue = (intptr_t)&ud.camerapos.y; + aGameVars[Gv_GetVarIndex("cameraz")].val.lValue = (intptr_t)&ud.camerapos.z; aGameVars[Gv_GetVarIndex("cameraang")].val.lValue = (intptr_t)&ud.cameraang; aGameVars[Gv_GetVarIndex("camerahoriz")].val.lValue = (intptr_t)&ud.camerahoriz; aGameVars[Gv_GetVarIndex("camerasect")].val.lValue = (intptr_t)&ud.camerasect; diff --git a/polymer/eduke32/source/lunatic/defs.ilua b/polymer/eduke32/source/lunatic/defs.ilua index af965a60d..297596e96 100644 --- a/polymer/eduke32/source/lunatic/defs.ilua +++ b/polymer/eduke32/source/lunatic/defs.ilua @@ -339,6 +339,13 @@ typedef struct { } tiledata_t; #pragma pack(pop) +typedef struct { + vec3_t pos; + int32_t dist, clock; + int16_t ang, horiz; + int16_t sect; +} camera_t; + // NOTE: not packed! typedef struct { ]] .. table.concat(con_lang.wdata_members, ';')..';' .. [[ @@ -355,7 +362,6 @@ enum // NOTE: not packed! typedef struct { - vec3_t camera; int32_t const_visibility,uw_framerate; int32_t camera_time,folfvel,folavel,folx,foly,fola; int32_t reccnt,crosshairscale; @@ -376,7 +382,6 @@ typedef struct { int32_t configversion; - int16_t cameraang, camerasect, camerahoriz; int16_t pause_on,from_bonus; int16_t camerasprite,last_camsprite; int16_t last_level,secretlevel, bgstretch; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 70e67df66..d374e2bd6 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -5418,7 +5418,7 @@ VOLUME_ALL_40x: if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) { G_UpdateScreenArea(); - g_cameraClock = totalclock; - g_cameraDistance = 65536L; + CAMERACLOCK = totalclock; + CAMERADIST = 65536; } } diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index a6314bc6b..b7cb78b36 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -466,7 +466,7 @@ static void P_PreFireHitscan(int32_t i, int32_t p, int32_t atwith, if (G_HaveEvent(EVENT_GETSHOTRANGE)) VM_OnEvent(EVENT_GETSHOTRANGE, i,p, -1, 0); -#if defined LUNATIC +#ifdef LUNATIC angRange = ps->angrange; zRange = ps->zrange; #else diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index c80b0ebbf..73d3caa1d 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -1744,8 +1744,8 @@ static void postloadplayer(int32_t savegamep) //1 if (g_player[myconnectindex].ps->over_shoulder_on != 0) { - g_cameraDistance = 0; - g_cameraClock = 0; + CAMERADIST = 0; + CAMERACLOCK = 0; g_player[myconnectindex].ps->over_shoulder_on = 1; } diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 233d460a1..2c4c0c34d 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -600,10 +600,10 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) return -1; } - cs = ud.camerasect; - ca = ud.cameraang; + cs = CAMERA(sect); + ca = CAMERA(ang); - explosionp = S_CalcDistAndAng(i, num, cs, ca, &ud.camera, pos, &sndist, &sndang); + explosionp = S_CalcDistAndAng(i, num, cs, ca, &CAMERA(pos), pos, &sndist, &sndang); pitch = S_GetPitch(num); peekps = g_player[screenpeek].ps; @@ -828,9 +828,9 @@ void S_Update(void) if (ud.camerasprite == -1) { - c = &ud.camera; - cs = ud.camerasect; - ca = ud.cameraang; + c = &CAMERA(pos); + cs = CAMERA(sect); + ca = CAMERA(ang); } else {