ScummVM API documentation
barriers.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_BARRIERS_H
28 #define ICB_BARRIERS_H
29 
30 #include "engines/icb/common/px_rcutypes.h"
31 #include "engines/icb/common/px_linkeddatafile.h"
32 #include "engines/icb/common/px_route_barriers.h"
33 
34 namespace ICB {
35 
36 #define MAX_slices 10
37 
38 //+1 for dummy top floor ceiling
39 #define MAX_heights (MAX_slices + 1)
40 
41 #define MAX_floors 48
42 
43 // this is the master number of objects -
44 // The +3 & ~3 - means it is rounded up to be a multiple of 4
45 #define MAX_props ((116 + 3) & ~3)
46 
47 #define MAX_parents_per_anim_slice 24
48 //#define MAX_bars_per_parent 96
49 #define MAX_props_per_parent 16
50 
51 #define MAX_animating_props 24
52 #define MAX_bars_per_prop 60
53 
54 #define MAX_child_groups_per_parent 16
55 
56 #define MAX_prop_abars (MAX_animating_props * MAX_bars_per_prop)
57 
58 //--------------------------------------------------------------------------------------
59 class _animating_parent { // contains all of the abarriers that lie within this parent space - for each we record its associated prop and
60  // state so we know when each is in scope
61 public:
62  uint8 num_props;
63  uint8 prop_number[MAX_props_per_parent];
64 };
65 
66 class _animating_barrier_slice { // contains a list of parents that lie within the slice
67  // and a list of props within the slice
68 public:
69  _animating_parent *anim_parents[MAX_parents_per_anim_slice];
70 
71  uint8 num_props_in_slice;
72  uint8 prop_list[MAX_props];
73 };
74 
75 class _anim_prop_info { // contains a list of all the abars for the prop
76 public:
77  uint8 barriers_per_state;
78  uint8 total_states; // temp - could be removed
79  uint16 *barrier_list; // pointer into 'prop_abar_table'
80 };
81 
83 
84 public:
85  void ___init();
86 
87  void Form_route_barrier_list(PXreal x, PXreal y, PXreal z, PXreal x2, PXreal z2);
88  void Form_parent_barrier_list(PXreal x, PXreal y, PXreal z);
89 
90  ParentBox *Fetch_parent_box_for_xyz(PXreal x, PXreal y, PXreal z, uint32 &par_num, uint32 &slice_num);
91  ParentBox *Fetch_parent_num_on_slice_y(uint32 requested_parent, PXreal y);
92  uint32 Fetch_number_of_child_boxes(ParentBox *parent);
93  ChildGroup *Fetch_child_box(ParentBox *parent, uint32 child);
94  RouteBarrier *Fetch_barrier(uint32 num);
95  uint32 Fetch_total_barriers();
96  LinkedDataFile *Get_barrier_pointer() const { return raw_barriers; }
97  void Prepare_animating_barriers();
98  uint32 Get_anim_barriers(uint32 n, uint32 *oThisCubesBarriers, uint32 slice);
99 
100  void Set_route_barrier_mask(int32 left, int32 right, int32 top, int32 bottom);
101  void Clear_route_barrier_mask();
102 
103  _animating_barrier_slice anim_slices[MAX_slices];
104 
105  _anim_prop_info anim_prop_info[MAX_props];
106 
107  uint16 prop_abar_table[MAX_animating_props * MAX_bars_per_prop];
108 
109  uint8 parents_used; // count how many of table are used
110  _animating_parent anim_parent_table[MAX_floors]; // storage
111 
112  // raw barriers
113  LinkedDataFile *raw_barriers; // raw route barriers used for routing/line of sight and maybe shadow geometry
114 
115  uint32 total_barriers;
116 
117  // route barrier wrapper file
118  LinkedDataFile *route_wrapper;
119 
120  uint32 total_slices; // useful out of file
121 
122  bool8 barrier_mask;
123  DXrect mask;
124 };
125 
126 inline void _barrier_handler::Set_route_barrier_mask(int32 left, int32 right, int32 top, int32 bottom) {
127  // certain route building will provide an inner rect that barriers must lie within
128  barrier_mask = TRUE8;
129 
130  mask.left = left;
131  mask.right = right;
132  mask.top = top;
133  mask.bottom = bottom;
134 }
135 
136 inline void _barrier_handler::Clear_route_barrier_mask() {
137  // cancel inner route barrier mask
138 
139  barrier_mask = FALSE8;
140 }
141 
142 inline uint32 _barrier_handler::Fetch_number_of_child_boxes(ParentBox *parent) { return (parent->num_childgroups); }
143 
144 inline ChildGroup *_barrier_handler::Fetch_child_box(ParentBox *parent, uint32 child) { return ((ChildGroup *)(((uint8 *)parent) + parent->childgroups[child])); }
145 
146 inline uint32 _barrier_handler::Fetch_total_barriers() { return (total_barriers); }
147 
148 } // End of namespace ICB
149 
150 #endif
Definition: px_route_barriers.h:190
Definition: barriers.h:82
Definition: actor.h:32
Definition: barriers.h:66
Definition: px_linkeddatafile.h:53
Definition: barriers.h:59
Definition: px_types.h:32
Definition: px_route_barriers.h:181
Definition: barriers.h:75
Definition: px_route_barriers.h:146