ScummVM API documentation
floors.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_FLOORS_H
28 #define ICB_FLOORS_H
29 
30 #include "engines/icb/common/px_common.h"
31 #include "engines/icb/common/px_linkeddatafile.h"
32 #include "engines/icb/prim_route_builder.h"
33 #include "engines/icb/common/px_floor_map.h"
34 #include "engines/icb/object_structs.h"
35 #include "engines/icb/barriers.h"
36 
37 namespace ICB {
38 
39 class _floor_world {
40 
41 public:
42  _floor_world();
43  ~_floor_world();
44  void ___init();
45 
46  uint32 Locate_floor_rect(PXreal x, PXreal z, PXreal y, _floor **rct);
47  uint32 Return_floor_rect(PXreal x, PXreal z, PXreal y, uint32 rubber);
48  bool8 Point_on_rubber_floor(PXreal x, PXreal z, PXreal y, uint32 rubber, uint32 rect_num);
49 
50  void Set_floor_rect_flag(_logic *log);
51  uint32 Return_non_rubber_floor_no(_logic *log, uint32 cur_rubber_floor);
52 
53  // floor router
54  void Pick_floor_route(uint32 start, uint32 dest);
55  void Find_shortest_floor_route(uint32 start, uint32 dest, uint32 x, uint32 z);
56  void Recurse_to_shortest(uint32 adjoining_floor, uint32 level, uint32 dest);
57  uint32 Calculate_floor_route_length(uint32 total_floors);
58 
59  PXreal Fetch_height(uint32 height);
60  int32 Fetch_total_heights();
61  uint32 Fetch_total_floors();
62 
63  PXreal Gravitise_y(PXreal y);
64 
65  PXreal Floor_safe_gravitise_y(PXreal fY);
66 
67  void Align_with_floor(_mega *mega);
68  PXreal Return_true_y(PXreal y);
69  bool8 On_a_floor(_mega *mega);
70 
71  // for external routines such as fn_functions
72  _floor *Fetch_named_floor(const char *name);
73  _floor *Fetch_floor_number(uint32 num);
74  PXreal Fetch_floors_volume_height(uint32 num);
75  uint32 Fetch_floor_number_by_name(const char *name);
76  uint32 Fetch_number_of_floors() const { return total_floors; }
77 
78  int32 Project_point_down_through_floors(int32 nX, int32 nY, int32 nZ);
79 
80  LinkedDataFile *floors; // the floor definition file
81 
82 private:
83  uint32 total_floors; // total number of individual floors
84 
85  uint32 total_heights; // how many unique heights
86  PXreal heights[MAX_heights]; // list of actual heights
87 
88  PXreal floor_y_volume[MAX_floors]; // table of depths for floors
89 };
90 
91 inline PXreal _floor_world::Fetch_floors_volume_height(uint32 num) { return floor_y_volume[num]; }
92 
93 inline PXreal _floor_world::Fetch_height(uint32 height) {
94  if (height >= total_heights) {
95  Fatal_error("can't get %d height of %d", height, total_heights);
96  }
97 
98  return (heights[height]);
99 }
100 
101 inline int32 _floor_world::Fetch_total_heights() { return (total_heights); }
102 
103 inline uint32 _floor_world::Fetch_total_floors() { return (total_floors); }
104 
105 inline _floor *_floor_world::Fetch_named_floor(const char *name) {
106  // return a pointer to a named floor to an external routine - most likely a fn_function
107  return ((_floor *)LinkedDataObject::Fetch_item_by_name(floors, name));
108 }
109 
110 inline _floor *_floor_world::Fetch_floor_number(uint32 num) {
111  // return a pointer to a named floor to an external routine - most likely a fn_function
112  return ((_floor *)LinkedDataObject::Fetch_item_by_number(floors, num));
113 }
114 
115 } // End of namespace ICB
116 
117 #endif
Definition: actor.h:32
Definition: object_structs.h:391
Definition: floors.h:39
Definition: px_linkeddatafile.h:53
Definition: px_floor_map.h:70
Definition: object_structs.h:211