1 //-------------------------------------------------------------------------
2 /*
3 Copyright (C) 1997, 2005 - 3D Realms Entertainment
4 
5 This file is part of Shadow Warrior version 1.2
6 
7 Shadow Warrior is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 
16 See the GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 
22 Original Source: 1997 - Frank Maddin and Jim Norwood
23 Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
24 */
25 //-------------------------------------------------------------------------
26 
27 #ifndef PANEL_H
28 
29 #define PANEL_H
30 
31    #include "mytypes.h"
32    #include "game.h"
33 
34 #define FRAG_BAR 2920
35 
36 #define PRI_FRONT_MAX   250
37 #define PRI_FRONT       192
38 #define PRI_MID         128
39 #define PRI_BACK        64
40 #define PRI_BACK_MAX    0
41 
42 #define MAKE_CONPIC_ENUM
43 enum conpic_id
44 {
45    #include "conpic.h"
46 };
47 typedef enum conpic_id CONPIC_ID;
48 #undef MAKE_CONPIC_ENUM
49 
50 enum PanelSpriteIDs
51     {
52     ID_BORDER_TOP = 1, ID_BORDER_BOTTOM, ID_BORDER_LEFT, ID_BORDER_RIGHT, ID_BORDER_SHADE,
53     ID_PANEL_BORDER_LEFT, ID_PANEL_BORDER_RIGHT,
54     ID_TEXT, ID_TEXT2, ID_TEXT3, ID_TEXT4
55     };
56 
57 struct PANEL_STATEstruct
58     {
59     short picndx;                       // for pip stuff in conpic.h
60     int tics;
61     void (*Animator) (PANEL_SPRITEp);	// JBF: return type was long
62     PANEL_STATEp NextState;
63     ULONG flags;
64     BYTE xvel;
65     BYTE yvel;
66     };
67 
68 #define PANF_PRIMARY         (BIT(0)) // denotes primary weapon
69 #define PANF_SECONDARY       (BIT(1)) // denotes secondary weapon
70 #define PANF_BOB             (BIT(2))
71 #define PANF_REST_POS        (BIT(3)) // used for certain weapons - fireball
72 #define PANF_RELOAD          (BIT(4)) // reload flag used for uzi
73 #define PANF_TRANS_FLIP      (BIT(5)) // translucent flip - matches rotate sprite
74 #define PANF_ACTION_POS      (BIT(6)) // used for certain weapons - fireball
75 #define PANF_WEAPON_HIDE     (BIT(7)) // hide when climbing/driving
76 #define PANF_TRANSLUCENT     (BIT(8)) // turn invisible
77 #define PANF_INVISIBLE       (BIT(9)) // turn invisible
78 #define PANF_DEATH_HIDE      (BIT(10)) // hide done when dead
79 #define PANF_KILL_AFTER_SHOW (BIT(11)) // kill after showing numpages times
80 #define PANF_SCREEN_CLIP     (BIT(12)) // maintain aspect to the screen
81 #define PANF_STATUS_AREA     (BIT(13)) // maintain aspect to the screen
82 #define PANF_IGNORE_START_MOST (BIT(14)) // maintain aspect to the screen
83 #define PANF_XFLIP           (BIT(15)) // xflip
84 #define PANF_SUICIDE         (BIT(16)) // kill myself
85 #define PANF_WEAPON_SPRITE   (BIT(17)) // its a weapon sprite - for V mode
86 #define PANF_CORNER          (BIT(18)) // draw from the corner
87 #define PANF_NOT_IN_VIEW     (BIT(19)) // not in view
88 #define PANF_UNHIDE_SHOOT    (BIT(20)) // shoot after un-hiding a weapon
89 #define PANF_JUMPING         (BIT(21))
90 #define PANF_FALLING         (BIT(22))
91 #define PANF_NON_MASKED      (BIT(23)) // tile should be drawn without transparency masking
92 #define PANF_SCALE_BOTTOM    (BIT(24)) // scale coordinates and align to the bottom of the screen
93 #define PANF_SCALE_TOP       (BIT(25)) // scale coordinates and align to the top of the screen
94 #define PANF_DRAW_BEFORE_VIEW (BIT(30)) // draw before drawrooms
95 #define PANF_NOT_ALL_PAGES       (BIT(31)) // DONT use permanentwritesprite bit for rotatesprite
96 
97 typedef VOID (*PANEL_SPRITE_FUNCp)(PANEL_SPRITEp);
98 
99 typedef struct
100     {
101     PANEL_STATEp State;
102     int flags;
103     short tics;
104     short pic;
105     short xoff; // from panel sprite center x
106     short yoff; // from panel sprite center y
107     }PANEL_SPRITE_OVERLAY, *PANEL_SPRITE_OVERLAYp;
108 
109 struct PANEL_SPRITEstruct
110     {
111     PANEL_SPRITEp Next, Prev;
112     PANEL_SPRITEp sibling;
113     PANEL_STATEp State, RetractState, PresentState, ActionState, RestState;
114     PLAYERp PlayerP;
115     // Do not change the order of this line
116     USHORT xfract;
117     SHORT x;
118     USHORT yfract;
119     SHORT y;                            // Do not change the order of this
120     // line
121 
122     PANEL_SPRITE_OVERLAY over[8];
123     PANEL_SPRITE_FUNCp PanelSpriteFunc;
124     short ID;                           // id for finding sprite types on the
125     // list
126     short picndx;                       // for pip stuff in conpic.h
127     short picnum;                       // bypass pip stuff in conpic.h
128     short x1, y1, x2, y2;               // for rotatesprites box cliping
129     short vel, vel_adj;
130     short numpages;
131     int xorig, yorig, flags, priority;
132     int scale;
133     int jump_speed, jump_grav;         // jumping vars
134     int xspeed;
135     short tics, delay;                  // time vars
136     short ang, rotate_ang;
137     short sin_ndx, sin_amt, sin_arc_speed;
138     short bob_height_shift;
139     short shade, pal;
140     short kill_tics;
141     short WeaponType; // remember my own weapon type for weapons with secondary function
142     };
143 
144 typedef struct
145     {
146     PANEL_STATEp pstate;
147     short state_size;
148     }PANEL_STATE_TABLE, *PANEL_STATE_TABLEp;
149 
150 extern PANEL_STATE_TABLE PanelStateTable[];
151 
152 // Panel State flags - also used for
153 #define psf_Invisible    BIT(16)
154 #define psf_QuickCall    BIT(23)
155 #define psf_Xflip        BIT(24)
156 #define psf_ShadeHalf    BIT(25)
157 #define psf_ShadeNone    BIT(26)
158 
159 enum BorderTypes
160 {
161 BORDER_NONE = 0,
162 BORDER_MINI_BAR = 1,
163 BORDER_BAR = 2
164 };
165 
166 #define MICRO_SIGHT_NUM 0
167 #define MICRO_SIGHT 2075
168 
169 #define MICRO_SHOT_NUM 2
170 #define MICRO_SHOT_20 2076
171 #define MICRO_SHOT_1 2077
172 
173 #define MICRO_HEAT_NUM 1
174 #define MICRO_HEAT 2084
175 
176 #define UZI_COPEN   2040
177 #define UZI_CCLOSED 2041
178 #define UZI_CLIT    2042
179 #define UZI_CRELOAD 2043
180 
181 #define HEAD_MODE1 2055
182 #define HEAD_MODE2 2056
183 #define HEAD_MODE3 2057
184 
185 #define SHOTGUN_AUTO_NUM 0
186 #define SHOTGUN_AUTO 2078
187 
188 extern int PanelScale;
189 
190 PANEL_SPRITEp pSpawnSprite(PLAYERp pp, PANEL_STATEp state, BYTE priority, int x, int y);
191 PANEL_SPRITEp pSpawnFullScreenSprite(PLAYERp pp, short pic, short pri, int x, int y);
192 PANEL_SPRITEp pSpawnFullViewSprite(PLAYERp pp,short pic,short pri,int x,int y);
193 void pSetSuicide(PANEL_SPRITEp psp);
194 BOOL pKillScreenSpiteIDs(PLAYERp pp, short id);
195 VOID pFlushPerms(PLAYERp pp);
196 VOID PreUpdatePanel(void);
197 void UpdatePanel(void );
198 void PlayerUpdateKeys(PLAYERp pp);
199 void PlayerUpdateArmor(PLAYERp pp,short value);
200 void pToggleCrosshair(PLAYERp pp);
201 void pKillSprite(PANEL_SPRITEp psp);
202 void InitChops(PLAYERp pp);
203 void ChopsSetRetract(PLAYERp pp);
204 VOID PlayerUpdateTimeLimit(PLAYERp pp);
205 
206 #endif
207