RetroBytes Portal

Programming => The Detective Game => Topic started by: flash on August 24, 2009, 08:22:14 pm

Title: Colmaps
Post by: flash on August 24, 2009, 08:22:14 pm
HK,

If you can let me know what colmap format you want to go with for the rooms, I would be happy to make them for you?

I need to know what you intend you use for a wall flag mainly.

One thing that may be tricky? The vertical movement is 1:1 but the diagonals on the end walls are 1:2. ie. up/down moves an exact diagonal and the walls have a lesser angle (45 degrees and.. er... um... 22.5?)

This makes the placement of impassable values a bit tricky as they could lead to up movement hitting an edge and causing a "stick to wall" if this is at the exact point where the 1:2 juts out for the next vertical.

or am I just rambling? God.. Who knows!!  ???
Title: Re: Colmaps
Post by: headkaze on August 25, 2009, 11:09:55 am
What I think we will need to do is change the x position of the sprites to be a floating point number so that moving up and down is more of an angle. When I had it moving two pixels across it was too fast so I will have to make it a float instead.

I will get a final list of colmap's values together soon.
Title: Re: Colmaps
Post by: headkaze on August 26, 2009, 12:01:51 pm
Here are the final ColMap values (for now)

COL_PATH = 0
COL_DOOR1 = 1
COL_DOOR2 = 2
COL_DOOR3 = 3
COL_DOOR4 = 4
COL_DOOR5 = 5
COL_DOOR6 = 6
COL_DOOR7 = 7
COL_SECRET_PASSAGE = 8
COL_WALL = 9
COL_DUMMY = 10
COL_FOUR_POSTER_BED = 11
COL_CHEST_OF_DRAWERS = 12
COL_FIREPLACE = 13
COL_COAL_BUCKET = 14
COL_PAINTING = 15
COL_WOODEN_BOX = 16
COL_MICROWAVE = 17
COL_SIDEBOARD = 18
COL_CUPBOARD1 = 19
COL_CUPBOARD2 = 20
COL_CUPBOARD3 = 21
COL_CUPBOARD4 = 22
COL_SINK = 23
COL_STAIRCASE = 24
COL_BOOKCASE1 = 25
COL_BOOKCASE2 = 26
COL_BOXES1 = 27
COL_BOXES2 = 28
COL_BOXES3 = 29
COL_BED = 30
COL_CLOTHES_CUPBOARD = 31
COL_CLOCK = 32
COL_WINDOW = 33
COL_DESK = 34
COL_SHELVES = 35
COL_LOCKED_WALL_SAFE = 36
COL_OPEN_WALL_SAFE = 37
COL_DINGLES_BODY = 38
COL_PIANO_AND_A_SQUASHED_CYNTHIA_SLUDGEBUCKET = 39
COL_GABRIELS_BODY = 40
COL_STABBED_DOCTOR = 41

Attached are two rooms with the colmaps done. I decided to have 0 as a path or area you can walk. I was going to have the walls and objects like beds filled in but then I though just having an edge of tiles set would be enough. But there are some problems that still need to be sorted out. You will see what I mean when you can walk through the bed a bit at the moment.

Nothing is set in stone yet but this is just some preliminary work on the collision and movement. It just needs a bit of tweaking related to rounding.
Title: Re: Colmaps
Post by: headkaze on August 27, 2009, 10:34:33 am
Okay had to update the two colmap's in the previous post. There were a few bugs in the previous version of ColMapEdit that made you think you were entering decimal numbers that were actually saving in hex.

So now you enter numbers in decimal and I had to fix the two maps. Also the collision code in TDG works perfectly now. I've added two sprites which shows the location in the colmap currently being testing. It also outputs the name of the object currently being collided with.

So everything is ready for the colmap's to be added. Did you want to do that Flash? Anyway this test code should make it easy. The only thing that needs to be done is that as each room is added the definition of the doorways needs to be added matching the numbers used for the doorways in the colmap.

ie.

Code: [Select]
m_roomArray[ROOM_HALL1]->SetDoor(DOOR_DOOR1, new CDoor(DOOR_DOOR1, DOORSTATE_OPEN, m_roomArray[ROOM_HALL1], m_roomArray[ROOM_REVEREND]));
m_roomArray[ROOM_HALL1]->SetDoor(DOOR_DOOR2, new CDoor(DOOR_DOOR2, DOORSTATE_OPEN, m_roomArray[ROOM_HALL1], m_roomArray[ROOM_CYNTHIA]));
m_roomArray[ROOM_HALL1]->SetDoor(DOOR_DOOR3, new CDoor(DOOR_DOOR3, DOORSTATE_OPEN, m_roomArray[ROOM_HALL1], m_roomArray[ROOM_DOCTOR]));
m_roomArray[ROOM_HALL1]->SetDoor(DOOR_DOOR4, new CDoor(DOOR_DOOR4, DOORSTATE_OPEN, m_roomArray[ROOM_HALL1], m_roomArray[ROOM_DINGLE]));
m_roomArray[ROOM_HALL1]->SetDoor(DOOR_DOOR5, new CDoor(DOOR_DOOR5, DOORSTATE_OPEN, m_roomArray[ROOM_HALL1], m_roomArray[ROOM_OUTSIDE1]));
m_roomArray[ROOM_HALL1]->SetDoor(DOOR_DOOR6, new CDoor(DOOR_DOOR6, DOORSTATE_OPEN, m_roomArray[ROOM_HALL1], m_roomArray[ROOM_LANDING]));
m_roomArray[ROOM_HALL1]->SetDoor(DOOR_DOOR7, new CDoor(DOOR_DOOR7, DOORSTATE_OPEN, m_roomArray[ROOM_HALL1], m_roomArray[ROOM_PASSAGE2]));

m_roomArray[ROOM_REVEREND]->SetDoor(DOOR_DOOR1, new CDoor(DOOR_DOOR1, DOORSTATE_OPEN, m_roomArray[ROOM_REVEREND], m_roomArray[ROOM_HALL1]));
m_roomArray[ROOM_CYNTHIA]->SetDoor(DOOR_DOOR1, new CDoor(DOOR_DOOR1, DOORSTATE_OPEN, m_roomArray[ROOM_CYNTHIA], m_roomArray[ROOM_HALL1]));
m_roomArray[ROOM_DOCTOR]->SetDoor(DOOR_DOOR1, new CDoor(DOOR_DOOR1, DOORSTATE_OPEN, m_roomArray[ROOM_DOCTOR], m_roomArray[ROOM_HALL1]));
m_roomArray[ROOM_DINGLE]->SetDoor(DOOR_DOOR1, new CDoor(DOOR_DOOR1, DOORSTATE_OPEN, m_roomArray[ROOM_DINGLE], m_roomArray[ROOM_HALL1]));
m_roomArray[ROOM_OUTSIDE1]->SetDoor(DOOR_DOOR1, new CDoor(DOOR_DOOR1, DOORSTATE_OPEN, m_roomArray[ROOM_OUTSIDE1], m_roomArray[ROOM_HALL1]));
m_roomArray[ROOM_LANDING]->SetDoor(DOOR_DOOR1, new CDoor(DOOR_DOOR1, DOORSTATE_OPEN, m_roomArray[ROOM_LANDING], m_roomArray[ROOM_HALL1]));

All this code does is add the doors saying which room is on this side of the door (m_roomIn) and which room is on the outside (m_roomOut). After they are defined it goes through linking all the doors to (m_doorOut). From then on when a door's state is set to DOORSTATE_OPEN or DOORSTATE_CLOSED then the door on each side is also set to the same state. The reason why each room has it's own door definition is because when Snide moves from one room to the other he needs to appear in the centre of the door. I calculate the centre of each door which needs to be different for each room. So instead of having a single door each room has a door that is linked via m_doorOut.
Title: Re: Colmaps
Post by: headkaze on August 27, 2009, 11:34:17 am
Well I'm gonna start working on the colmap's now. There is not that much work involved so I might as well get them out of the way. At least after this I can add all the door links so you can move around the entire mansion.
Title: Re: Colmaps
Post by: flash on August 27, 2009, 12:28:49 pm
Lol, I did not even get a chance to reply to the last post... You are really going for it mate  :)