Thursday, April 29, 2010

Its been a while.

Eh, haven't really payed much attention to this blog lately. But I honestly had nothing to blog about, till now. When its 3am and I'm bored.

Firstly, I got the game Battlefield Bad Company 2, which is basically the overrated Call of Duty Modern Warfare 2 but with tanks, choppers, and destructible buildings. Its great fun as you make your own doorways for buildings amongst the chaos.

Secondly, I just whipped up some pseudo-code for the map editor of my program. This is basically to help me view a tileset sprite easily no matter what the dimensions the BMP are. Which will be useful if I just was to cut and paste random tilesets off from the interwebs.

Oh and the code for getting which section of the slice to show is:

VTILE_VIEW = ROUNDUP(HTILE*page);
HTILE_VIEW = page*VTILE_VIEW;

EDIT: It seems that pseudo-code was written wrong, but I guess thats what 3am does to you, fixed (in C++ code and Psuedo code):

Code:
tilev_view = (int)ceil((float)page/tileh_pages);
tileh_view = page-((tilev_view-1)*tilev_pages);

Psuedo:
VTILE_VIEW = ROUNDUP(PAGE/HTILE_PAGES);
HTILE_VIEW = page-((VTILE_VIEW-1)*VTILE_PAGES)


These variables will basically be manipulated later to show the first 200 pixels of the BMP or the 200 pixels after that and so forth. Basically so I can calculate what range of pixels to show on-screen.

(Tileset: A BMP filled with images that may represent walls, floor, buildings and etc in a 2D universe e.g.
)

No comments:

Post a Comment