Tilemap editor scrolling implemented

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent cec17fb0de
commit 3166c8e162
  1. BIN
      C++ProjectTemplate
  2. BIN
      assets/terrainmap.png
  3. BIN
      assets/terrainmap.xcf
  4. 18
      main.cpp
  5. 2
      save0

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

@ -179,6 +179,7 @@ int CHAPTER_NUMBER=0;
int SAVE_FILE_CURSOR=0;
std::string CUTSCENE_DISPLAY_TEXT="";
int CUTSCENE_DISPLAY_TEXT_DELAY_TIME=0;
int TILEMAP_EDITOR_OFFSET=0;
/*
[Choice1,Choice2,Choice3]
@ -1331,11 +1332,17 @@ void SeasonI::updateGame(){
}
if (GetMouse(0).bHeld) {
int selectedTileX=GetMouseX()/TILEMAP_EDITOR_TILESIZE;
int selectedTileY=GetMouseY()/TILEMAP_EDITOR_TILESIZE;
if (selectedTileX*TILEMAP_EDITOR_DRAW_MULT>=0&&selectedTileX*TILEMAP_EDITOR_DRAW_MULT<TILEMAP_SIZE_X&&selectedTileY*TILEMAP_EDITOR_DRAW_MULT<TILEMAP_SIZE_Y&&selectedTileY*TILEMAP_EDITOR_DRAW_MULT>=0) {
int selectedTileY=GetMouseY()/TILEMAP_EDITOR_TILESIZE+TILEMAP_EDITOR_OFFSET/TILEMAP_EDITOR_TILESIZE;
if (selectedTileX*TILEMAP_EDITOR_DRAW_MULT>=0&&selectedTileX*TILEMAP_EDITOR_DRAW_MULT<CURRENT_MAP->tileset->sprite->width&&selectedTileY*TILEMAP_EDITOR_DRAW_MULT<CURRENT_MAP->tileset->sprite->height&&selectedTileY*TILEMAP_EDITOR_DRAW_MULT>=0) {
SELECTED_TILE={selectedTileX,selectedTileY};
}
}
if ((GetMouseWheel()<0||GetKey(PGDN).bHeld)&&TILEMAP_EDITOR_OFFSET<CURRENT_MAP->tileset->sprite->height-TILEMAP_EDITOR_TILESIZE) {
TILEMAP_EDITOR_OFFSET+=TILEMAP_EDITOR_TILESIZE;
} else
if ((GetMouseWheel()>0||GetKey(PGUP).bHeld)&&TILEMAP_EDITOR_OFFSET>0) {
TILEMAP_EDITOR_OFFSET-=TILEMAP_EDITOR_TILESIZE;
}
}break;
case GameState::ENCOUNTER_SELECT:{
if (!GetKey(SHIFT).bHeld) {
@ -3048,8 +3055,10 @@ void SeasonI::drawGame(){
case GameState::TILE_SELECT:{
//14x14 pixels per tile.
Clear(Pixel(64,64,128));
DrawDecal({0,0},SPRITES["terrainmap.png"],{TILEMAP_EDITOR_DRAW_MULT,TILEMAP_EDITOR_DRAW_MULT});
DrawRectDecal(SELECTED_TILE*(TILEMAP_EDITOR_TILESIZE),{TILEMAP_EDITOR_TILESIZE,TILEMAP_EDITOR_TILESIZE},RED);
vi2d drawpos={0,-TILEMAP_EDITOR_OFFSET};
DrawDecal(drawpos,SPRITES["terrainmap.png"],{TILEMAP_EDITOR_DRAW_MULT,TILEMAP_EDITOR_DRAW_MULT});
vi2d calculatedTile={SELECTED_TILE.x,SELECTED_TILE.y-(int)(TILEMAP_EDITOR_OFFSET/TILEMAP_EDITOR_TILESIZE)};
DrawRectDecal(calculatedTile*(TILEMAP_EDITOR_TILESIZE),{TILEMAP_EDITOR_TILESIZE,TILEMAP_EDITOR_TILESIZE},RED);
}break;
case GameState::OBJ_SELECT:{
vd2d drawpos={0,0};
@ -3178,6 +3187,7 @@ void SeasonI::drawGame(){
GetMousePos().y>=drawpos.y&&
GetMousePos().y<drawpos.y+24) {
LoadMap(map);
TILEMAP_EDITOR_OFFSET=0;
EDITING_LAYER=layer::COLLISION;
EnableLayer(layer::COLLISION,false);
}

@ -1 +1 @@
120 120 PLAYER 30 30 8 8 4 0 0 0 0 0 0 0 11 9 10 13 14 15 16 17 33 29 21 25 1 4 6 3 4 7 8 3668.08 223.298 120 120 NESS 30 30 8 8 4 0 0 0 0 0 0 0 6 33 34 29 30 31 32 0 3 -1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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 748503 609611 PLAYER 0
120 120 PLAYER 30 30 8 8 4 0 0 0 0 0 0 0 11 9 10 13 14 15 16 17 33 29 21 25 1 6 4 3 4 7 8 3597.94 214.891 120 120 NESS 30 30 8 8 4 0 0 0 0 0 0 0 6 33 34 29 30 31 32 0 3 -1 7 12 0 6.9218e-310 120 120 PAULA 30 30 8 8 4 0 0 0 0 0 0 0 6 21 22 23 24 37 38 0 3 -1 7 -1 0 0 120 120 JEFF 30 30 8 8 4 0 0 0 0 0 0 0 1 0 0 3 -1 -1 -1 -999 -999 120 120 ANNA 30 30 8 8 4 0 0 0 0 0 0 0 4 21 25 26 29 0 3 5 7 12 4.24399e-314 1.99468e-312 120 120 KING 30 30 8 8 4 0 0 0 0 0 0 0 1 0 0 3 -1 -1 -1 -999 -999 120 120 POO 30 30 8 8 4 0 0 0 0 0 0 0 1 0 0 3 -1 -1 -1 -999 -999 48 6 7 7 7 7 7 7 7 7 7 7 3 3 3 10 10 10 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 11 0 6 2 0 1 512 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0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