Specific map editor question (tilemap)
Hey ya''ll~
I''ve started a Directx RPG map editor for my upcoming game (it''s always upcoming, isn''t it). In a couple days I''ve come to the point where I need to be able to change the tiles on multiple layers. This requires switching between layers, tiles, and putting them down on the map. My current routine (greatly summarized) is as such:
VK_PRIOR, VK_NEXT, VK_HOME, and VK_END change the tile number down and up, and change the layer number down and up, respectively. These work fine.
This is my tile-plotting routine. Basically it puts the SelectedTile value into the bymap[60][60][2]. I have problems here.
if (KEYSTATE(VK_SPACE)){ if(SelectedLayer==1){ byMap[player.move.xTile][player.move.yTile][0]=SelectedTileLayer1;}
if(SelectedLayer==2){ byMap[player.move.xTile][player.move.yTile][1]=SelectedTileLayer2;}
if(SelectedLayer==3){ byMap[player.move.xTile][player.move.yTile][2]=SelectedTileLayer3;}
}
And lastly, the draw routine. Order: Layer 1(background), Layer 2(transparent tiles added onto Layer1 - flowers on grass, yada yada), Layer 3 is NPC layer (not really layer), and Layer 4 is the above NPC layer (so they can go behind layers)
// plot the first layer (layer 0 for bymap)
if(Layer1Viewable){
for (x=xStart; x<=xEnd; x++)
{
for (y=yStart; y<=yEnd; y++)
{
// blit the tile
byTile = byMap[x][y][0];
lpddsBack->Blt(&rcDest, lpddsLayer1Tileset, &lptile[byTile]->rcLocation, DDBLT_WAIT, NULL);
// advance rcDest RECT
rcDest.bottom += 32;
rcDest.top += 32;
}
// reset rcDest RECT to top of next column
rcDest.left += 32;
rcDest.right += 32;
rcDest.bottom -= ((yEnd - yStart + 1) << 5);
rcDest.top -= ((yEnd - yStart + 1) << 5);
}
}
This is basically the draw routine (change some variables names for others). However, I can also turn off layers (like Zsnes) using F1-F4. Doing so changes the output of the screen. Is something wrong with the Spacebar routine, or the draw routine? The mapfile is 60x60, First layer value 1 all the way across (grass), layer 2/4 is 0 (transparent). Are there any apparent problems, or do I have to elaborate more?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement