From eefdce5b04bef51052e2b6ab269fb72537a60f4d Mon Sep 17 00:00:00 2001 From: Kp Date: Fri, 22 Aug 2014 02:27:13 +0000 Subject: [PATCH] Reduce nesting of vms_vector::{x,y,z} --- common/include/vecmat.h | 16 ++++------------ similar/editor/eglobal.cpp | 2 +- similar/main/endlevel.cpp | 2 +- similar/main/morph.cpp | 2 +- similar/main/terrain.cpp | 2 +- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/common/include/vecmat.h b/common/include/vecmat.h index b51607626..26be0470e 100644 --- a/common/include/vecmat.h +++ b/common/include/vecmat.h @@ -35,21 +35,13 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. //The basic fixed-point vector. Access elements by name or position struct vms_vector { - union { - struct - { - fix x, y, z; - }; - }; + fix x, y, z; }; #define DEFINE_SERIAL_VMS_VECTOR_TO_MESSAGE() \ DEFINE_SERIAL_UDT_TO_MESSAGE(vms_vector, v, (v.x, v.y, v.z)); \ ASSERT_SERIAL_UDT_MESSAGE_SIZE(vms_vector, 12) -typedef struct vms_vector vms_vector_array; - - //Angle vector. Used to store orientations struct vms_angvec { @@ -97,10 +89,10 @@ extern const vms_matrix vmd_identity_matrix; //Here's a handy constant -#define ZERO_VECTOR {{{0,0,0}}} -#define IDENTITY_MATRIX { {{{f1_0,0,0}}}, {{{0,f1_0,0}}}, {{{0,0,f1_0}}} } +#define ZERO_VECTOR {0,0,0} +#define IDENTITY_MATRIX { {f1_0,0,0}, {0,f1_0,0}, {0,0,f1_0} } -const vms_vector vmd_zero_vector = ZERO_VECTOR; +const vms_vector vmd_zero_vector ZERO_VECTOR; //negate a vector static inline void vm_vec_negate(vms_vector *v) diff --git a/similar/editor/eglobal.cpp b/similar/editor/eglobal.cpp index f2e00e492..bbc2fbe76 100644 --- a/similar/editor/eglobal.cpp +++ b/similar/editor/eglobal.cpp @@ -59,7 +59,7 @@ int Show_axes_flag = 0; // 0 = don't show, !0 = do show coordinate axes in *Curs uint Update_flags = UF_ALL; //force total redraw int Funky_chase_mode = 0; vms_angvec Seg_orientation = {0,0,0}; -vms_vector Seg_scale = {{{F1_0*20,F1_0*20,F1_0*20}}}; +vms_vector Seg_scale{F1_0*20,F1_0*20,F1_0*20}; int mine_changed = 0; int ModeFlag; editor_view *current_view; diff --git a/similar/main/endlevel.cpp b/similar/main/endlevel.cpp index f9712e14f..50814d6e8 100644 --- a/similar/main/endlevel.cpp +++ b/similar/main/endlevel.cpp @@ -158,7 +158,7 @@ vms_vector satellite_pos,satellite_upvec; //!!grs_bitmap **exit_bitmap_list[1]; int station_modelnum,exit_modelnum,destroyed_exit_modelnum; -static vms_vector station_pos = {{{0xf8c4<<10,0x3c1c<<12,0x372<<10}}}; +static vms_vector station_pos{0xf8c4<<10,0x3c1c<<12,0x372<<10}; #ifdef STATION_ENABLED static grs_bitmap *station_bitmap; diff --git a/similar/main/morph.cpp b/similar/main/morph.cpp index 8c2fc17e2..ead04b961 100644 --- a/similar/main/morph.cpp +++ b/similar/main/morph.cpp @@ -261,7 +261,7 @@ void do_morph_frame(object *obj) } -static const vms_vector morph_rotvel = {{{0x4000,0x2000,0x1000}}}; +static const vms_vector morph_rotvel{0x4000,0x2000,0x1000}; void init_morphs() { diff --git a/similar/main/terrain.cpp b/similar/main/terrain.cpp index 1e3f2a157..6fa4be9d4 100644 --- a/similar/main/terrain.cpp +++ b/similar/main/terrain.cpp @@ -398,7 +398,7 @@ static void get_pnt(vms_vector *p,int i,int j) p->y = HEIGHT(i,j)*HEIGHT_SCALE; } -static const vms_vector light = {{{0x2e14,0xe8f5,0x5eb8}}}; +static const vms_vector light{0x2e14,0xe8f5,0x5eb8}; static fix get_face_light(vms_vector *p0,vms_vector *p1,vms_vector *p2) {