Use template for object rotation functions
This commit is contained in:
parent
988df1cc42
commit
d6359d0eb7
|
@ -33,12 +33,6 @@ namespace dsx {
|
||||||
int ObjectSelectNextInMine(void);
|
int ObjectSelectNextInMine(void);
|
||||||
int ObjectSelectPrevInMine(void);
|
int ObjectSelectPrevInMine(void);
|
||||||
|
|
||||||
int ObjectDecreaseBankBig();
|
|
||||||
int ObjectIncreaseBankBig();
|
|
||||||
int ObjectDecreasePitchBig();
|
|
||||||
int ObjectIncreasePitchBig();
|
|
||||||
int ObjectDecreaseHeadingBig();
|
|
||||||
int ObjectIncreaseHeadingBig();
|
|
||||||
int ObjectFlipObject();
|
int ObjectFlipObject();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -230,12 +230,26 @@ int ObjectMoveNearer();
|
||||||
int ObjectMoveFurther();
|
int ObjectMoveFurther();
|
||||||
int ObjectSelectNextinSegment();
|
int ObjectSelectNextinSegment();
|
||||||
int ObjectSelectNextType();
|
int ObjectSelectNextType();
|
||||||
int ObjectDecreaseBank();
|
|
||||||
int ObjectIncreaseBank();
|
template <int p, int b, int h>
|
||||||
int ObjectDecreasePitch();
|
int ObjectChangeRotation();
|
||||||
int ObjectIncreasePitch();
|
|
||||||
int ObjectDecreaseHeading();
|
#define ROTATION_UNIT (4096/4)
|
||||||
int ObjectIncreaseHeading();
|
|
||||||
|
#define ObjectDecreaseBank ObjectChangeRotation<0, -ROTATION_UNIT, 0>
|
||||||
|
#define ObjectIncreaseBank ObjectChangeRotation<0, ROTATION_UNIT, 0>
|
||||||
|
#define ObjectDecreasePitch ObjectChangeRotation<-ROTATION_UNIT, 0, 0>
|
||||||
|
#define ObjectIncreasePitch ObjectChangeRotation<ROTATION_UNIT, 0, 0>
|
||||||
|
#define ObjectDecreaseHeading ObjectChangeRotation<0, 0, -ROTATION_UNIT>
|
||||||
|
#define ObjectIncreaseHeading ObjectChangeRotation<0, 0, ROTATION_UNIT>
|
||||||
|
|
||||||
|
#define ObjectDecreaseBankBig ObjectChangeRotation<0, -(ROTATION_UNIT*4), 0>
|
||||||
|
#define ObjectIncreaseBankBig ObjectChangeRotation<0, (ROTATION_UNIT*4), 0>
|
||||||
|
#define ObjectDecreasePitchBig ObjectChangeRotation<-(ROTATION_UNIT*4), 0, 0>
|
||||||
|
#define ObjectIncreasePitchBig ObjectChangeRotation<(ROTATION_UNIT*4), 0, 0>
|
||||||
|
#define ObjectDecreaseHeadingBig ObjectChangeRotation<0, 0, -(ROTATION_UNIT*4)>
|
||||||
|
#define ObjectIncreaseHeadingBig ObjectChangeRotation<0, 0, (ROTATION_UNIT*4)>
|
||||||
|
|
||||||
int ObjectResetObject();
|
int ObjectResetObject();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -62,8 +62,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#define OBJ_SCALE (F1_0/2)
|
#define OBJ_SCALE (F1_0/2)
|
||||||
#define OBJ_DEL_SIZE (F1_0/2)
|
#define OBJ_DEL_SIZE (F1_0/2)
|
||||||
|
|
||||||
#define ROTATION_UNIT (4096/4)
|
|
||||||
|
|
||||||
static void show_objects_in_segment(const vcsegptr_t sp)
|
static void show_objects_in_segment(const vcsegptr_t sp)
|
||||||
{
|
{
|
||||||
range_for (const auto i, objects_in(sp))
|
range_for (const auto i, objects_in(sp))
|
||||||
|
@ -720,19 +718,25 @@ int ObjectFlipObject()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObjectDecreaseBank() {return rotate_object(Cur_object_index, 0, -ROTATION_UNIT, 0);}
|
template <int p, int b, int h>
|
||||||
int ObjectIncreaseBank() {return rotate_object(Cur_object_index, 0, ROTATION_UNIT, 0);}
|
int ObjectChangeRotation()
|
||||||
int ObjectDecreasePitch() {return rotate_object(Cur_object_index, -ROTATION_UNIT, 0, 0);}
|
{
|
||||||
int ObjectIncreasePitch() {return rotate_object(Cur_object_index, ROTATION_UNIT, 0, 0);}
|
return rotate_object(vobjptridx(Cur_object_index), p, b, h);
|
||||||
int ObjectDecreaseHeading() {return rotate_object(Cur_object_index, 0, 0, -ROTATION_UNIT);}
|
}
|
||||||
int ObjectIncreaseHeading() {return rotate_object(Cur_object_index, 0, 0, ROTATION_UNIT);}
|
|
||||||
|
|
||||||
int ObjectDecreaseBankBig() {return rotate_object(Cur_object_index, 0, -(ROTATION_UNIT*4), 0);}
|
template int ObjectDecreaseBank();
|
||||||
int ObjectIncreaseBankBig() {return rotate_object(Cur_object_index, 0, (ROTATION_UNIT*4), 0);}
|
template int ObjectIncreaseBank();
|
||||||
int ObjectDecreasePitchBig() {return rotate_object(Cur_object_index, -(ROTATION_UNIT*4), 0, 0);}
|
template int ObjectDecreasePitch();
|
||||||
int ObjectIncreasePitchBig() {return rotate_object(Cur_object_index, (ROTATION_UNIT*4), 0, 0);}
|
template int ObjectIncreasePitch();
|
||||||
int ObjectDecreaseHeadingBig() {return rotate_object(Cur_object_index, 0, 0, -(ROTATION_UNIT*4));}
|
template int ObjectDecreaseHeading();
|
||||||
int ObjectIncreaseHeadingBig() {return rotate_object(Cur_object_index, 0, 0, (ROTATION_UNIT*4));}
|
template int ObjectIncreaseHeading();
|
||||||
|
|
||||||
|
template int ObjectDecreaseBankBig();
|
||||||
|
template int ObjectIncreaseBankBig();
|
||||||
|
template int ObjectDecreasePitchBig();
|
||||||
|
template int ObjectIncreasePitchBig();
|
||||||
|
template int ObjectDecreaseHeadingBig();
|
||||||
|
template int ObjectIncreaseHeadingBig();
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
// Move object around based on clicks in 2d screen.
|
// Move object around based on clicks in 2d screen.
|
||||||
|
|
Loading…
Reference in a new issue