2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 ///////////////////////////////////////////////////////////////////////////////
7 // $Header: r:/t2repos/thief2/src/sim/roompa.h,v 1.8 2000/01/31 10:00:36 adurant Exp $
36 typedef int eEnterResult
;
38 ////////////////////////////////////////////////////////////////////////////////
40 class cRoomPropResult
;
42 typedef cDListNode
<cRoomPropResult
, 0> cRoomPropResultNode
;
43 typedef cDList
<cRoomPropResult
, 0> cRoomPropResultListBase
;
45 class cRoomPropResult
: public cRoomPropResultNode
48 cRoomPropResult(const cRoom
*init_room
);
53 inline cRoomPropResult::cRoomPropResult(const cRoom
*init_room
)
58 ////////////////////////////////////////
60 class cRoomPropResultList
: public cRoomPropResultListBase
63 ~cRoomPropResultList() { DestroyAll(); }
66 ////////////////////////////////////////
69 #define MAX_BF_ROOMS 1024
71 // array elements for A* search
75 void Init(mxs_real _dist
, int _previous_room
, int _previous_portal
, short _next_active
, short _prev_active
)
78 previous_room
= _previous_room
+ 1;
79 previous_portal
= _previous_portal
+ 1;
80 next_active
= _next_active
+ 1;
81 prev_active
= _prev_active
+ 1;
84 mxs_real
GetDist() const { return dist
; };
85 void SetDist(mxs_real _dist
) { dist
= _dist
; };
87 int GetPreviousRoom() const { return previous_room
- 1; };
88 void SetPreviousRoom(int _previous_room
) { previous_room
= _previous_room
+ 1; };
90 int GetPreviousRoom2() const { return previous_room_2
- 1; };
91 void SetPreviousRoom2(int _previous_room_2
) { previous_room_2
= _previous_room_2
+ 1; };
93 void SwitchPreviousRooms()
98 previous_room
= previous_room_2
;
99 previous_room_2
= temp
;
101 temp
= previous_portal
;
102 previous_portal
= previous_portal_2
;
103 previous_portal_2
= temp
;
106 int GetPreviousPortal() const { return previous_portal
- 1; };
107 void SetPreviousPortal(int _previous_portal
) { previous_portal
= _previous_portal
+ 1; };
109 int GetPreviousPortal2() const { return previous_portal
- 1; };
110 void SetPreviousPortal2(int _previous_portal_2
) { previous_portal_2
= _previous_portal_2
+ 1; };
112 short GetNextActive() const { return next_active
- 1; };
113 void SetNextActive(short _next_active
) { next_active
= _next_active
+ 1; };
115 short GetPrevActive() const { return prev_active
- 1; };
116 void SetPrevActive(short _prev_active
) { prev_active
= _prev_active
+ 1; };
119 mxs_real dist
; // distance to get to this room
120 short previous_room
; // how we got to this room
121 short previous_room_2
; // secondary previous room
122 short previous_portal
; // the portal we used to get here
123 short previous_portal_2
; // secondary previous portal
124 short next_active
; // the next room id in the active list
125 short prev_active
; // the previous room id in the active list
128 ////////////////////////////////////////////////////////////////////////////////
130 class cRoomPropAgent
;
135 cRoomPropAgent
*GetPropAgent
;
137 virtual int EnterCallback(const cRoom
*room
, const cRoomPortal
*enterPortal
, const mxs_vector
&enterPt
, mxs_real dist
) = 0;
138 virtual void ExitCallback(const cRoom
*room
) = 0;
139 virtual mxs_real
PortalsCallback(const cRoomPortal
*enterPortal
, const cRoomPortal
*exitPortal
, mxs_real dist
) = 0;
141 cRoomPropAgent
*m_RoomPropAgent
;
144 ////////////////////////////////////////////////////////////////////////////////
152 // Constructor / Destructor
162 void SetFunctions(cRoomPAFuncs
*funcs
);
164 void PropagateBF(const mxs_vector
&startPos
, const cRoom
*startRoom
);
165 void PropagateDF(const mxs_vector
&startPos
, const cRoom
*startRoom
);
167 void GetRoomPath(const cRoom
*endRoom
, cRoomPropResultList
*pResultList
) const;
168 const cBFRoomInfo
*GetRoomBrushInfo() const;
172 void PropagateRec(const cRoom
*curRoom
, const cRoomPortal
*enterPortal
, const mxs_vector
&startPt
, mxs_real dist
, int depth
);
174 cRoomPAFuncs
*m_Funcs
;
176 cBFRoomInfo m_BFRoomInfo
[MAX_BF_ROOMS
];
179 ////////////////////////////////////////////////////////////////////////////////
181 inline const cBFRoomInfo
*cRoomPropAgent::GetRoomBrushInfo() const
186 ////////////////////////////////////////////////////////////////////////////////
188 inline void cRoomPropAgent::SetFunctions(cRoomPAFuncs
*funcs
)
191 m_Funcs
->m_RoomPropAgent
= this;
194 ////////////////////////////////////////////////////////////////////////////////