Tweak to mission2 movement, map editor

This commit is contained in:
stevenhowes
2021-04-06 19:52:01 +01:00
parent bf2cc9e635
commit 436fea16e4
6 changed files with 422 additions and 38 deletions
+14 -21
View File
@@ -32,6 +32,8 @@ struct TilePlayer_s {
struct EntityLocation_s hitbox_bl;
struct EntityLocation_s hitbox_tr;
struct EntityLocation_s mapoffset;
struct EntityLocation_s localtile;
int rawtile;
};
struct TilePlayer_s TilePlayer;
@@ -165,7 +167,7 @@ void game2_tick_input()
if(input_readkey(57))
{
TilePlayer.location.Y += 3 * (tick - lasttick);
if(TilePlayer.location.Y > (9*100))
if(TilePlayer.location.Y > (950))
{
TilePlayer.location.Y = 100;
TilePlayer.mapoffset.Y += 10;
@@ -176,7 +178,7 @@ void game2_tick_input()
if(input_readkey(41))
{
TilePlayer.location.Y -= 3 * (tick - lasttick);
if(TilePlayer.location.Y < (1*100))
if(TilePlayer.location.Y < (10))
{
TilePlayer.location.Y = 900;
TilePlayer.mapoffset.Y -= 10;
@@ -187,7 +189,7 @@ void game2_tick_input()
if(input_readkey(121))
{
TilePlayer.location.X += 3 * (tick - lasttick);
if(TilePlayer.location.X > (9*100))
if(TilePlayer.location.X > (950))
{
TilePlayer.location.X = 100;
TilePlayer.mapoffset.X += 10;
@@ -198,24 +200,12 @@ void game2_tick_input()
if(input_readkey(25))
{
TilePlayer.location.X -= 3 * (tick - lasttick);
if(TilePlayer.location.X < (1*100))
if(TilePlayer.location.X < (10))
{
TilePlayer.location.X = 900;
TilePlayer.mapoffset.X -= 10;
}
}
// Q
if(input_readkey(16))
{
for(x = 0; x < TILESX; x++)
{
for(y = 0; y < TILESY; y++)
{
map[0][x][y] = 1;
}
}
}
}
int game2_tick()
@@ -244,6 +234,8 @@ int game2_tick()
{
map[1][x][y] = 255;
map[2][x][y] = 255;
TilePlayer.localtile.X = x;
TilePlayer.localtile.Y = y;
}
if(map[0][x][y] ^ map[screen+1][x][y])
@@ -254,13 +246,14 @@ int game2_tick()
udt++;
}
}
//draw_sprite("lcarsblack",1000,DISPLAY_Y-164);
//sprintf(textbuffer,"CPF: %i\nUDT: %i",(tick-lasttick), udt);
//draw_spritetext(textbuffer, 1070, 950);
}
draw_sprite("lcarsblack",1000,DISPLAY_Y-164);
TilePlayer.rawtile = (TilePlayer.mapoffset.Y) + TilePlayer.localtile.Y + (TilePlayer.mapoffset.X * 100) + (TilePlayer.localtile.X * 100);
sprintf(textbuffer,"Tile:%i\nSprite:%i",TilePlayer.rawtile,fullmap[TilePlayer.rawtile]);
draw_spritetext(textbuffer, 1070, 950);
game2_tick_input();
draw_sprite("man",TilePlayer.location.X,TilePlayer.location.Y);