1 /*******************************************************************
2 *
3 * DESCRIPTION: r2base.cpp
4 *
5 * AUTHOR: David Malcolm
6 *
7 * HISTORY: Created 14/11/97
8 *
9 *******************************************************************/
10
11 /* Includes ********************************************************/
12 #include "3dc.h"
13 #include "r2base.h"
14 #include "inline.h"
15
16
17 #define UseLocalAssert Yes
18 #include "ourasert.h"
19
20 /* Version settings ************************************************/
21
22 /* Constants *******************************************************/
23
24 /* Macros **********************************************************/
25
26 /* Imported function prototypes ************************************/
27
28 /* Imported data ***************************************************/
29
30
31 /* Exported globals ************************************************/
32 /*static*/ const r2pos r2pos :: Origin = r2pos(0,0);
33 /*static*/ r2rect r2rect :: R2Rect_PhysicalScreen = r2rect(0,0,640,480);
34
35 /* Internal type definitions ***************************************/
36
37 /* Internal function prototypes ************************************/
38
39 /* Internal globals ************************************************/
40
41 /* Exported function definitions ***********************************/
FixP_Scale(int FixP_ScaleFactor) const42 r2pos r2pos :: FixP_Scale
43 (
44 int FixP_ScaleFactor
45 ) const
46 {
47 // assumes the position to be in 16:16 fixed point,
48 // returns the position scaled by the fixed pt factor
49
50 return r2pos
51 (
52 MUL_FIXED(x, FixP_ScaleFactor),
53 MUL_FIXED(y, FixP_ScaleFactor)
54 );
55 }
56
57 extern "C" {
58 void D3D_Rectangle(int x0, int y0, int x1, int y1, int r, int g, int b, int a);
59 };
60
AlphaFill(unsigned char R,unsigned char G,unsigned char B,unsigned char translucency) const61 void r2rect :: AlphaFill
62 (
63 unsigned char R,
64 unsigned char G,
65 unsigned char B,
66 unsigned char translucency
67 ) const
68 {
69 GLOBALASSERT
70 (
71 bValidPhys()
72 );
73
74 D3D_Rectangle(x0, y0, x1, y1, R, G, B, translucency);
75 }
76
operator +(const r2pos & R2Pos_1,const r2pos & R2Pos_2)77 r2pos operator+ ( const r2pos& R2Pos_1, const r2pos& R2Pos_2 )
78 {
79 return r2pos
80 (
81 R2Pos_1 . x + R2Pos_2 . x,
82 R2Pos_1 . y + R2Pos_2 . y
83 );
84 }
85
86
R2BASE_ScreenModeChange_Setup(void)87 extern void R2BASE_ScreenModeChange_Setup(void)
88 {
89 /* PRECONDITION */
90 {
91 }
92
93 /* CODE */
94 {
95 }
96 }
97
98 extern "C" {
99 extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
100 };
101
R2BASE_ScreenModeChange_Cleanup(void)102 extern void R2BASE_ScreenModeChange_Cleanup(void)
103 {
104 /* PRECONDITION */
105 {
106 }
107
108 /* CODE */
109 {
110
111 r2rect :: R2Rect_PhysicalScreen .x1 = ScreenDescriptorBlock.SDB_Width;
112 r2rect :: R2Rect_PhysicalScreen .y1 = ScreenDescriptorBlock.SDB_Height;
113 }
114 }
115
116
117 /* Internal function definitions ***********************************/
118