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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 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     uint32_t flags;
64     uint8_t xvel;
65     uint8_t 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_DRAW_BEFORE_VIEW (BIT(30)) // draw before drawrooms
92 #define PANF_NOT_ALL_PAGES       (BIT(31)) // DONT use permanentwritesprite bit for rotatesprite
93 
94 typedef void (*PANEL_SPRITE_FUNCp)(PANEL_SPRITEp);
95 
96 typedef struct
97 {
98     PANEL_STATEp State;
99     int flags;
100     short tics;
101     short pic;
102     short xoff; // from panel sprite center x
103     short yoff; // from panel sprite center y
104 } PANEL_SPRITE_OVERLAY, *PANEL_SPRITE_OVERLAYp;
105 
106 struct PANEL_SPRITEstruct
107 {
108     PANEL_SPRITEp Next, Prev;
109     PANEL_SPRITEp sibling;
110     PANEL_STATEp State, RetractState, PresentState, ActionState, RestState;
111     PLAYERp PlayerP;
112     // Do not change the order of this line
113     uint16_t xfract;
114     int16_t x;
115     uint16_t yfract;
116     int16_t y;                            // Do not change the order of this
117     // line
118 
119     PANEL_SPRITE_OVERLAY over[8];
120     PANEL_SPRITE_FUNCp PanelSpriteFunc;
121     short ID;                           // id for finding sprite types on the
122     // list
123     short picndx;                       // for pip stuff in conpic.h
124     short picnum;                       // bypass pip stuff in conpic.h
125     short x1, y1, x2, y2;               // for rotatesprites box cliping
126     short vel, vel_adj;
127     short numpages;
128     int xorig, yorig, flags, priority;
129     int scale;
130     int jump_speed, jump_grav;         // jumping vars
131     int xspeed;
132     short tics, delay;                  // time vars
133     short ang, rotate_ang;
134     short sin_ndx, sin_amt, sin_arc_speed;
135     short bob_height_shift;
136     short shade, pal;
137     short kill_tics;
138     short WeaponType; // remember my own weapon type for weapons with secondary function
139 };
140 
141 typedef struct
142 {
143     PANEL_STATEp pstate;
144     short state_size;
145 } PANEL_STATE_TABLE, *PANEL_STATE_TABLEp;
146 
147 extern PANEL_STATE_TABLE PanelStateTable[];
148 
149 // Panel State flags - also used for
150 #define psf_Invisible    BIT(16)
151 #define psf_QuickCall    BIT(23)
152 #define psf_Xflip        BIT(24)
153 #define psf_ShadeHalf    BIT(25)
154 #define psf_ShadeNone    BIT(26)
155 
156 enum BorderTypes
157 {
158     BORDER_NONE = 0,
159     BORDER_MINI_BAR = 1,
160     BORDER_BAR = 2
161 };
162 
163 #define MICRO_SIGHT_NUM 0
164 #define MICRO_SIGHT 2075
165 
166 #define MICRO_SHOT_NUM 2
167 #define MICRO_SHOT_20 2076
168 #define MICRO_SHOT_1 2077
169 
170 #define MICRO_HEAT_NUM 1
171 #define MICRO_HEAT 2084
172 
173 #define UZI_COPEN   2040
174 #define UZI_CCLOSED 2041
175 #define UZI_CLIT    2042
176 #define UZI_CRELOAD 2043
177 
178 #define HEAD_MODE1 2055
179 #define HEAD_MODE2 2056
180 #define HEAD_MODE3 2057
181 
182 #define SHOTGUN_AUTO_NUM 0
183 #define SHOTGUN_AUTO 2078
184 
185 PANEL_SPRITEp pSpawnSprite(PLAYERp pp, PANEL_STATEp state, uint8_t priority, int x, int y);
186 PANEL_SPRITEp pSpawnFullScreenSprite(PLAYERp pp, short pic, short pri, int x, int y);
187 PANEL_SPRITEp pSpawnFullViewSprite(PLAYERp pp,short pic,short pri,int x,int y);
188 void pSetSuicide(PANEL_SPRITEp psp);
189 SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id);
190 void pFlushPerms(PLAYERp pp);
191 void PreUpdatePanel(void);
192 void UpdatePanel(void);
193 void PlayerUpdateKeys(PLAYERp pp);
194 void PlayerUpdateArmor(PLAYERp pp,short value);
195 void pToggleCrosshair(void);
196 void pKillSprite(PANEL_SPRITEp psp);
197 void InitChops(PLAYERp pp);
198 void ChopsSetRetract(PLAYERp pp);
199 void PlayerUpdateTimeLimit(PLAYERp pp);
200 
201 #endif
202