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.
26 #include <boost/format.hpp>
29 #define CAOS_LVALUE_TARG_ROOM(name, check, get, set) \
30 CAOS_LVALUE_TARG(name, \
31 shared_ptr<Room> r = roomContainingAgent(targ); \
37 #define CAOS_LVALUE_ROOM_SIMPLE(name, expr) \
38 CAOS_LVALUE_TARG_ROOM(name, (void)0, expr, expr = newvalue)
41 ADDM (integer) x (integer) y (integer) width (integer) height (integer) background (string)
44 Creates a metaroom with the given height and width, at the coordinates given. Returns the id of the new metaroom.
46 void caosVM::v_ADDM() {
48 VM_PARAM_STRING(background
)
49 VM_PARAM_INTEGER(height
)
50 VM_PARAM_INTEGER(width
)
54 MetaRoom
*r
= new MetaRoom(x
, y
, width
, height
, background
);
56 v
.setInt(world
.map
.addMetaRoom(r
));
61 ADDB (command) metaroom_id (integer) background (string)
64 Adds a new background to an existing metaroom, to be displayed with BKGD.
66 void caosVM::c_ADDB() {
67 VM_PARAM_STRING(background
)
68 VM_PARAM_INTEGER(metaroomid
)
70 MetaRoom
*m
= world
.map
.getMetaRoom(metaroomid
);
73 m
->addBackground(background
);
77 BRMI (command) metaroom_base (integer) room_base (integer)
80 Sets the base ID numbers for new metarooms and rooms to the given values.
82 void caosVM::c_BRMI() {
85 VM_PARAM_INTEGER(room_base
)
86 VM_PARAM_INTEGER(metaroom_base
)
88 world
.map
.room_base
= room_base
;
89 world
.map
.metaroom_base
= metaroom_base
;
93 MAPD (command) width (integer) height (integer)
96 Sets the world map dimensions, inside which metarooms are placed.
98 void caosVM::c_MAPD() {
100 VM_PARAM_INTEGER(height
)
101 VM_PARAM_INTEGER(width
)
103 world
.map
.SetMapDimensions(width
, height
);
110 Returns the width of the world map.
112 void caosVM::v_MAPW() {
113 result
.setInt(world
.map
.getWidth());
120 Returns the height of the world map.
122 void caosVM::v_MAPH() {
123 result
.setInt(world
.map
.getHeight());
130 Resets and empties the world map.
132 void caosVM::c_MAPK() {
139 BKDS (string) metaroomid (integer)
142 Determines all of the background names in use by the given metaroom, and returns them in a comma-seperated string.
144 void caosVM::v_BKDS() {
145 VM_PARAM_INTEGER(metaroomid
)
147 MetaRoom
*m
= world
.map
.getMetaRoom(metaroomid
);
150 std::vector
<std::string
> backs
= m
->backgroundList();
152 for (std::vector
<std::string
>::iterator i
= backs
.begin(); i
!= backs
.end(); i
++) {
163 ADDR (integer) metaroomid (integer) x_left (integer) x_right (integer) y_left_ceiling (integer) y_right_ceiling (integer) y_left_floor (integer) y_right_floor (integer)
166 Makes a new room inside the given metaroom. Rooms can have sloped floors and ceilings, but only vertical walls.
167 The id of the new room is returned.
169 void caosVM::v_ADDR() {
171 VM_PARAM_INTEGER(y_right_floor
)
172 VM_PARAM_INTEGER(y_left_floor
)
173 VM_PARAM_INTEGER(y_right_ceiling
)
174 VM_PARAM_INTEGER(y_left_ceiling
)
175 VM_PARAM_INTEGER(x_right
)
176 VM_PARAM_INTEGER(x_left
)
177 VM_PARAM_INTEGER(metaroomid
)
179 shared_ptr
<Room
> r(new Room(x_left
, x_right
,
180 y_left_ceiling
, y_right_ceiling
,
181 y_left_floor
, y_right_floor
));
182 MetaRoom
*m
= world
.map
.getMetaRoom(metaroomid
);
185 r
->id
= m
->addRoom(r
);
186 result
.setInt(r
->id
);
190 RTYP (command) roomid (integer) roomtype (integer)
193 Defines the 'type' of the given room. The types vary with different games.
195 void caosVM::c_RTYP() {
197 VM_PARAM_INTEGER(roomtype
)
198 VM_PARAM_INTEGER(roomid
)
200 shared_ptr
<Room
> room
= world
.map
.getRoom(roomid
);
202 room
->type
= roomtype
;
206 RTYP (integer) roomid (integer)
209 Returns the 'type' of the given room, or -1 if 'roomid' is invalid.
211 void caosVM::v_RTYP() {
213 VM_PARAM_INTEGER(roomid
)
215 shared_ptr
<Room
> room
= world
.map
.getRoom(roomid
);
217 result
.setInt(room
->type
.getInt());
226 %pragma implementation caosVM::v_RTYP_c2
228 Returns the room type of the room at the centre point of targ.
230 void caosVM::v_RTYP_c2() {
232 shared_ptr
<Room
> r
= world
.map
.roomAt(targ
->x
+ (targ
->getWidth() / 2.0f
), targ
->y
+ (targ
->getHeight() / 2.0f
));
233 if (!r
) result
.setInt(-1);
235 result
.setInt(r
->type
.getInt());
240 SETV RTYP (command) roomtype (integer)
244 Sets the type of the given room to roomtype.
246 void caosVM::c_SETV_RTYP() {
248 VM_PARAM_INTEGER(roomtype
);
250 // TODO: this does actually work on targ, right?
251 // seems to work for the airlock, anyway -nornagon
253 shared_ptr
<Room
> r
= world
.map
.roomAt(targ
->x
+ (targ
->getWidth() / 2.0f
), targ
->y
+ (targ
->getHeight() / 2.0f
));
254 if (!r
) return; // TODO: correct behaviour?
256 r
->type
.setInt(roomtype
);
260 DOOR (command) room1 (integer) room2 (integer) perm (integer)
263 Sets how permeable the door between the two given rooms will be. (See PERM).
265 void caosVM::c_DOOR() {
267 VM_PARAM_INTEGER(perm
)
268 VM_PARAM_INTEGER(room2
)
269 VM_PARAM_INTEGER(room1
)
271 shared_ptr
<Room
> r1
= world
.map
.getRoom(room1
);
272 shared_ptr
<Room
> r2
= world
.map
.getRoom(room2
);
273 caos_assert(r1
); caos_assert(r2
);
274 if (r1
->doors
.find(r2
) == r1
->doors
.end()) {
275 RoomDoor
*door
= new RoomDoor
;
279 r1
->doors
[r2
] = door
;
280 r2
->doors
[r1
] = door
;
282 RoomDoor
*door
= r1
->doors
[r2
];
288 DOOR (integer) room1 (integer) room2 (integer)
291 void caosVM::v_DOOR() {
292 VM_PARAM_INTEGER(room2
)
293 VM_PARAM_INTEGER(room1
)
295 result
.setInt(-1); // TODO
299 RATE (command) roomtype (integer) caindex (integer) gain (float) loss (float) diffusion (float)
302 Defines the rates of the given CA in the given room. 'gain' defines how easily the CA will be absorbed from
303 agents inside the room, 'loss' defines how much will be lost into the air, and 'diffusion' defines how easily it
304 will spread to other rooms.
306 void caosVM::c_RATE() {
308 VM_PARAM_FLOAT(diffusion
)
311 VM_PARAM_INTEGER(caindex
)
312 VM_PARAM_INTEGER(roomtype
)
317 info
.diffusion
= diffusion
;
318 world
.carates
[roomtype
][caindex
] = info
;
321 shared_ptr
<Room
> roomContainingAgent(AgentRef agent
) {
322 MetaRoom
*m
= world
.map
.metaRoomAt(agent
->x
, agent
->y
);
323 if (!m
) return shared_ptr
<Room
>();
324 return m
->roomAt(agent
->x
+ (agent
->getWidth() / 2.0f
), agent
->y
+ (agent
->getHeight() / 2.0f
));
328 ROOM (integer) agent (agent)
331 Returns the room that contains the given agent (jugding by its center).
333 void caosVM::v_ROOM() {
335 VM_PARAM_VALIDAGENT(agent
)
337 shared_ptr
<Room
> r
= roomContainingAgent(agent
);
339 result
.setInt(r
->id
);
348 Returns the left constant (0).
350 void caosVM::v_LEFT() {
360 Returns the right constant (1).
362 void caosVM::v_RGHT() {
371 %pragma implementation caosVM::v_UP
373 Returns the up constant (2).
375 void caosVM::v_UP() {
385 Returns the down constant (3).
387 void caosVM::v_DOWN() {
394 PROP (command) roomid (integer) caindex (integer) cavalue (float)
397 Defines the level of the given CA in the given room. Valid settings are between 0 and 1; if higher, it will be
400 void caosVM::c_PROP() {
402 VM_PARAM_FLOAT(cavalue
)
403 VM_PARAM_INTEGER(caindex
)
404 VM_PARAM_INTEGER(roomid
)
409 caos_assert(0.0f
<= cavalue
);
410 caos_assert(0 <= caindex
&& caindex
<= 19);
412 shared_ptr
<Room
> room
= world
.map
.getRoom(roomid
);
414 room
->ca
[caindex
] = cavalue
;
418 PROP (float) roomid (integer) caindex (integer)
421 Returns the level of the given CA in the given room, or 0 if a roomid of -1 is passed.
423 void caosVM::v_PROP() {
425 VM_PARAM_INTEGER(caindex
)
426 VM_PARAM_INTEGER(roomid
)
428 caos_assert(0 <= caindex
&& caindex
<= 19);
431 result
.setFloat(0.0f
);
435 shared_ptr
<Room
> room
= world
.map
.getRoom(roomid
);
437 result
.setFloat(room
->ca
[caindex
]);
441 PERM (command) perm (integer)
444 Sets the TARG agent's permiability. Valid settings are between 1 and 100.
446 void caosVM::c_PERM() {
448 VM_PARAM_INTEGER(perm
)
450 // TODO: setting of 0 valid?
451 if (perm
< 0) perm
= 0;
452 if (perm
> 100) perm
= 100;
462 Returns the TARG agent's permiability.
464 void caosVM::v_PERM() {
468 result
.setInt(targ
->perm
);
472 GRAP (integer) x (float) y (float)
475 Returns the id of the room at the coordinates (x, y), or -1 if nothing's there.
477 void caosVM::v_GRAP() {
482 shared_ptr
<Room
> room
= world
.map
.roomAt(x
, y
);
484 result
.setInt(room
->id
);
491 GMAP (integer) x (float) y (float)
494 Returns the id of the metaroom at the coordinates (x, y), or -1 if nothing's there.
496 void caosVM::v_GMAP() {
501 MetaRoom
*room
= world
.map
.metaRoomAt(x
, y
);
503 result
.setInt(room
->id
);
510 LINK (command) room1 (integer) room2 (integer) perm (integer)
513 Defines the permeability of the link between the two given rooms. This is used for CA diffusion.
515 void caosVM::c_LINK() {
517 VM_PARAM_INTEGER(perm
)
518 VM_PARAM_INTEGER(room2
)
519 VM_PARAM_INTEGER(room1
)
521 shared_ptr
<Room
> one
= world
.map
.getRoom(room1
);
522 shared_ptr
<Room
> two
= world
.map
.getRoom(room2
);
523 caos_assert(one
&& two
);
529 LINK (integer) room1 (integer) room2 (integer)
532 Returns the permeability of the link between the given two rooms, or 0 if no link exists.
534 void caosVM::v_LINK() {
535 VM_PARAM_INTEGER(room2
)
536 VM_PARAM_INTEGER(room1
)
538 shared_ptr
<Room
> one
= world
.map
.getRoom(room1
);
539 shared_ptr
<Room
> two
= world
.map
.getRoom(room2
);
540 caos_assert(one
&& two
);
542 result
.setInt(0); // TODO
546 GRID (integer) agent (agent) direction (integer)
549 Returns the nearest adjacent room to the specified agent in the given direction (one of the direction constants), or
552 void caosVM::v_GRID() {
554 VM_PARAM_INTEGER(direction
) caos_assert(direction
>= 0); caos_assert(direction
<= 3);
555 VM_PARAM_VALIDAGENT(agent
)
558 Point src
= targ
->boundingBoxPoint(direction
);
563 dest
.x
-= targ
->range
.getFloat(); break;
565 dest
.x
+= targ
->range
.getFloat(); break;
567 dest
.y
-= targ
->range
.getFloat(); break;
569 dest
.y
+= targ
->range
.getFloat(); break;
572 shared_ptr
<Room
> ourRoom
= world
.map
.roomAt(src
.x
, src
.y
);
574 // (should we REALLY check for it being in the room system, here?)
575 cerr
<< agent
->identify() << " tried using GRID but isn't in the room system!\n";
580 unsigned int dummy1
; Line dummy2
; Point point
; shared_ptr
<Room
> room
;
581 bool collided
= world
.map
.collideLineWithRoomBoundaries(src
, dest
, ourRoom
, room
, point
, dummy2
, dummy1
, targ
->perm
);
583 if (!room
) result
.setInt(-1);
584 else result
.setInt(room
->id
);
588 EMIT (command) caindex (integer) amount (float)
591 Makes the TARG agent continually emit the specified amount of the specified CA into the room.
593 void caosVM::c_EMIT() {
595 VM_PARAM_FLOAT(amount
)
596 VM_PARAM_INTEGER(caindex
)
598 caos_assert((0 <= caindex
&& caindex
<= 19) || caindex
== -1);
601 targ
->emitca_index
= caindex
;
602 targ
->emitca_amount
= amount
;
608 %pragma variants c2 cv c3
610 Returns the direction of the last wall the TARG agent collided with.
612 void caosVM::v_WALL() {
616 result
.setInt(targ
->lastcollidedirection
);
620 ALTR (command) roomid (integer) caindex (integer) delta (float)
623 Modifies the level of the given CA in the room specified.
624 If 'roomid' is -1, the room containing the TARG agent will be used.
626 void caosVM::c_ALTR() {
628 VM_PARAM_FLOAT(delta
);
629 VM_PARAM_INTEGER(caindex
);
630 VM_PARAM_INTEGER(roomid
);
632 caos_assert(0 <= caindex
&& caindex
<= 19);
634 shared_ptr
<Room
> room
;
637 room
= world
.map
.roomAt(targ
->x
+ (targ
->getWidth() / 2.0f
), targ
->y
+ (targ
->getHeight() / 2.0f
));
639 room
= world
.map
.getRoom(roomid
);
641 float newvalue
= room
->ca
[caindex
] + delta
;
642 if (newvalue
< 0.0f
) newvalue
= 0.0f
;
643 else if (newvalue
> 1.0f
) newvalue
= 1.0f
;
644 room
->ca
[caindex
] = newvalue
;
648 RLOC (string) roomid (integer)
651 Returns a string containing the location of the given room in the following format: x_left, x_right, y_left_ceiling,
652 y_right_ceiling, y_left_floor, y_right_floor.
654 void caosVM::v_RLOC() {
655 VM_PARAM_INTEGER(roomid
)
657 shared_ptr
<Room
> r
= world
.map
.getRoom(roomid
);
660 result
.setString(boost::str(boost::format("%d %d %d %d %d %d") % r
->x_left
% r
->x_right
% r
->y_left_ceiling
% r
->y_right_ceiling
% r
->y_left_floor
% r
->y_right_floor
));
664 MLOC (string) metaroomid (integer)
667 Returns a string containing the location of the given metaroom in the following format: x y width height
669 void caosVM::v_MLOC() {
670 VM_PARAM_INTEGER(metaroomid
)
672 MetaRoom
*r
= world
.map
.getMetaRoom(metaroomid
);
675 result
.setString(boost::str(boost::format("%d %d %d %d") % r
->x() % r
->y() % r
->width() % r
->height()));
679 DMAP (command) mapon (integer)
682 Turns the debug map on and off, which shows the edges of rooms and vehicles.
684 void caosVM::c_DMAP() {
685 VM_PARAM_INTEGER(mapon
)
687 world
.showrooms
= mapon
;
691 SYS: DMAP (command) mapon (integer)
695 void caosVM::c_SYS_DMAP() {
700 ERID (string) metaroom_id (integer)
703 Returns a space-seperated list of all room id's contained by the given metaroom.
705 void caosVM::v_ERID() {
706 VM_PARAM_INTEGER(metaroom_id
)
710 if (metaroom_id
== -1) {
713 MetaRoom
*r
= world
.map
.getMetaRoom(metaroom_id
);
714 for (std::vector
<shared_ptr
<Room
> >::iterator i
= r
->rooms
.begin(); i
!= r
->rooms
.end(); i
++) {
715 if (out
.size() > 0) out
= out
+ " ";
716 out
= out
+ boost::str(boost::format("%d") % (*i
)->id
);
720 result
.setString(out
);
724 DELR (command) room_id (integer)
726 %pragma variants c2 cv c3
728 Removes the given room from the map.
730 void caosVM::c_DELR() {
731 VM_PARAM_INTEGER(room_id
)
733 shared_ptr
<Room
> r
= world
.map
.getRoom(room_id
);
740 DELM (command) metaroom_id (integer)
743 Removes the given metaroom from the map.
745 void caosVM::c_DELM() {
746 VM_PARAM_INTEGER(metaroom_id
)
748 MetaRoom
*r
= world
.map
.getMetaRoom(metaroom_id
);
755 HIRP (integer) roomid (integer) caindex (integer) direction (integer)
758 void caosVM::v_HIRP() {
759 VM_PARAM_INTEGER(direction
)
760 VM_PARAM_INTEGER(caindex
) caos_assert(0 <= caindex
&& caindex
<= 19);
761 VM_PARAM_INTEGER(roomid
)
763 shared_ptr
<Room
> r
= world
.map
.getRoom(roomid
);
766 result
.setInt(roomid
); // TODO
770 LORP (integer) roomid (integer) caindex (integer) direction (integer)
773 void caosVM::v_LORP() {
774 VM_PARAM_INTEGER(direction
)
775 VM_PARAM_INTEGER(caindex
) caos_assert(0 <= caindex
&& caindex
<= 19);
776 VM_PARAM_INTEGER(roomid
)
778 shared_ptr
<Room
> r
= world
.map
.getRoom(roomid
);
781 result
.setInt(roomid
); // TODO
785 TORX (float) roomid (integer)
788 void caosVM::v_TORX() {
789 VM_PARAM_INTEGER(roomid
)
791 shared_ptr
<Room
> r
= world
.map
.getRoom(roomid
);
795 float centrex
= r
->x_left
+ ((r
->x_right
- r
->x_left
) / 2.0f
);
796 result
.setFloat(centrex
- targ
->x
);
800 TORY (float) roomid (integer)
803 void caosVM::v_TORY() {
804 VM_PARAM_INTEGER(roomid
)
806 shared_ptr
<Room
> r
= world
.map
.getRoom(roomid
);
810 // TODO: calculate this however c2e does it.. or at least check this is right
811 float topy
= (r
->y_left_ceiling
- r
->y_right_ceiling
) / 2.0f
;
812 if (topy
>= 0.0f
) topy
= r
->y_left_ceiling
+ topy
;
813 else topy
= r
->y_right_ceiling
- topy
;
815 float bottomy
= (r
->y_left_floor
- r
->y_right_floor
) / 2.0f
;
816 if (bottomy
>= 0.0f
) topy
= r
->y_left_floor
+ bottomy
;
817 else bottomy
= r
->y_right_floor
- bottomy
;
819 float centrey
= topy
+ ((bottomy
- topy
) / 2.0f
);
820 result
.setFloat(centrey
- targ
->y
);
824 CACL (command) family (integer) genus (integer) species (integer) caindex (integer)
827 void caosVM::c_CACL() {
828 VM_PARAM_INTEGER(caindex
) caos_assert(0 <= caindex
&& caindex
<= 19);
829 VM_PARAM_INTEGER(species
) caos_assert(0 <= species
&& species
<= 65535);
830 VM_PARAM_INTEGER(genus
) caos_assert(0 <= genus
&& genus
<= 255);
831 VM_PARAM_INTEGER(family
) caos_assert(0 <= family
&& family
<= 255);
841 Always returns zero, since this command was stubbed in C1.
843 void caosVM::v_WIND() {
850 %pragma variants c1 c2
852 CAOS_LVALUE_ROOM_SIMPLE(TEMP
, r
->temp
);
859 CAOS_LVALUE_ROOM_SIMPLE(LITE
, r
->lite
);
866 CAOS_LVALUE_ROOM_SIMPLE(RADN
, r
->radn
);
873 CAOS_LVALUE_ROOM_SIMPLE(ONTR
, r
->ontr
);
880 CAOS_LVALUE_ROOM_SIMPLE(INTR
, r
->intr
);
887 CAOS_LVALUE_ROOM_SIMPLE(PRES
, r
->pres
);
894 CAOS_LVALUE_ROOM_SIMPLE(HSRC
, r
->hsrc
);
901 CAOS_LVALUE_ROOM_SIMPLE(LSRC
, r
->lsrc
);
908 CAOS_LVALUE_ROOM_SIMPLE(RSRC
, r
->rsrc
);
915 CAOS_LVALUE_ROOM_SIMPLE(PSRC
, r
->psrc
);
922 void caosVM::v_WNDX() {
924 shared_ptr
<Room
> r
= roomContainingAgent(targ
);
926 result
.setInt(r
->windx
);
934 void caosVM::v_WNDY() {
936 shared_ptr
<Room
> r
= roomContainingAgent(targ
);
938 result
.setInt(r
->windy
);
942 DOCA (command) times (integer)
945 void caosVM::c_DOCA() {
946 VM_PARAM_INTEGER(times
)
952 SETV DOOR (command) direction (integer) room1 (integer) room2 (integer) value (integer)
956 void caosVM::c_SETV_DOOR() {
957 VM_PARAM_INTEGER(value
)
958 VM_PARAM_INTEGER(room2
)
959 VM_PARAM_INTEGER(room1
)
960 VM_PARAM_INTEGER(perm
)
962 // TODO: what's direction for?
964 // code identical to c2e DOOR
965 shared_ptr
<Room
> r1
= world
.map
.getRoom(room1
);
966 shared_ptr
<Room
> r2
= world
.map
.getRoom(room2
);
967 caos_assert(r1
); caos_assert(r2
);
968 if (r1
->doors
.find(r2
) == r1
->doors
.end()) {
969 RoomDoor
*door
= new RoomDoor
;
973 r1
->doors
[r2
] = door
;
974 r2
->doors
[r1
] = door
;
976 RoomDoor
*door
= r1
->doors
[r2
];
986 Return y coordinate of floor below centre of target agent.
988 void caosVM::v_FLOR() {
991 result
.setInt(0); // TODO
999 Return the number of horizontal pixels per piece of ground level data.
1001 void caosVM::v_GNDW() {
1002 result
.setInt(4); // TODO: is it always 4? :)
1006 GRND (integer) index (integer)
1010 Return the ground level data at the provided index. See GNDW to work out the index required.
1012 void caosVM::v_GRND() {
1013 VM_PARAM_INTEGER(index
)
1015 result
.setInt(0); // TODO
1019 ROOM (command) roomno (integer) left (integer) top (integer) right (integer) bottom (integer) type (integer)
1023 Create or modify a room.
1025 void caosVM::c_ROOM() {
1026 VM_PARAM_INTEGER(type
)
1027 VM_PARAM_INTEGER(bottom
)
1028 VM_PARAM_INTEGER(right
)
1029 VM_PARAM_INTEGER(top
)
1030 VM_PARAM_INTEGER(left
)
1031 VM_PARAM_INTEGER(roomno
)
1033 shared_ptr
<Room
> r
= world
.map
.getRoom(roomno
);
1035 shared_ptr
<Room
> r2(new Room(left
, right
, top
, top
, bottom
, bottom
));
1038 MetaRoom
*m
= world
.map
.getMetaRoom(0);
1039 unsigned int roomid
= m
->addRoom(r
);
1040 assert(roomid
== (unsigned int)roomno
); // TODO: this is fairly likely to fail, but is a major bug if it does, FIX ME!
1044 r
->y_left_ceiling
= r
->y_right_ceiling
= top
;
1045 r
->y_left_floor
= r
->y_right_floor
= bottom
;
1048 r
->type
.setInt(type
);
1052 ROOM (integer) roomno (integer) data (integer)
1055 %pragma implementation caosVM::v_ROOM_c1
1057 Return some data for the specified room number. Data of 0 is left, 1 is right, 2 is top, 3 is bottom, 4 is room type. Returns 0 if no such room.
1059 void caosVM::v_ROOM_c1() {
1060 VM_PARAM_INTEGER(data
) caos_assert(data
>= 0 && data
<= 4);
1061 VM_PARAM_INTEGER(roomno
)
1063 shared_ptr
<Room
> r
= world
.map
.getRoom(data
);
1071 result
.setInt(r
->x_left
);
1075 result
.setInt(r
->x_right
);
1079 result
.setInt(r
->y_left_ceiling
);
1083 result
.setInt(r
->y_left_floor
);
1087 result
.setInt(r
->type
.getInt());
1092 /* vim: set noet: */