add support to SDLBackend for rendering 24bit data
[openc2e.git] / Room.h
blob4ad0217eedb0ca9b8481d4d59bdfc7bffa6116fd
1 /*
2 * Room.h
3 * openc2e
5 * Created by Alyssa Milburn on Tue May 25 2004.
6 * Copyright (c) 2004 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #ifndef _C2E_ROOM_H
21 #define _C2E_ROOM_H
23 #include <map>
24 #include <set>
25 #include <utility>
26 #include "physics.h"
27 #include "caosVar.h"
28 #include <iostream>
29 #include <algorithm>
30 #include <boost/weak_ptr.hpp>
32 using std::cerr;
34 #define CA_COUNT 20
36 struct RoomDoor {
37 boost::weak_ptr<class Room> first, second;
38 unsigned short perm;
41 class Room {
42 public:
43 std::map<boost::weak_ptr<Room>,RoomDoor *> doors;
44 unsigned int x_left, x_right, y_left_ceiling, y_right_ceiling;
45 unsigned int y_left_floor, y_right_floor;
47 std::vector<std::pair<unsigned int, unsigned int> > floorpoints;
49 Line left, right, top, bot;
51 caosVar type;
53 // Creatures 2
54 caosVar temp, lite, radn, ontr, intr, pres, hsrc, lsrc, rsrc, psrc;
55 caosVar floorvalue, dropstatus;
56 int windx, windy;
58 std::string music;
60 unsigned int id;
61 class MetaRoom *metaroom;
63 float ca[CA_COUNT], catemp[CA_COUNT];
65 bool containsPoint(float x, float y) {
66 if (x > (float)x_right || x < (float)x_left) { return false; }
67 if (bot.pointAtX(x).y < y) { return false; }
68 if (top.pointAtX(x).y > y) { return false; }
69 return true;
72 bool containsPoint(Point p) { return containsPoint(p.x, p.y); }
74 float floorYatX(float x);
76 Room();
77 Room(unsigned int x_l, unsigned int x_r, unsigned int y_l_t, unsigned int y_r_t, unsigned int y_l_b, unsigned int y_r_b);
78 void tick();
79 void postTick();
80 void resetTick();
82 void renderBorders(class Surface *surf, int xoffset, int yoffset, unsigned int col);
85 #endif
86 /* vim: set noet: */