Path: chuka.playstation.co.uk!news From: yaroze@theburrow.co.uk (Barry & Robert Swan) Newsgroups: scee.yaroze.beginners Subject: Re: map-tastic tile question Date: Sun, 20 Jun 1999 01:33:30 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 50 Message-ID: <376c42c9.1519220@www.netyaroze-europe.com> References: <7kalnc$4fj2@chuka.playstation.co.uk> <7kbrdi$4fj7@chuka.playstation.co.uk> NNTP-Posting-Host: p8Ds05a03.client.global.net.uk X-Newsreader: Forte Free Agent 1.11/32.235 unfortunaltey, seeing as Im half drunk, not sure how much of this has been covered in previous posts. point 1) Ive noticed the compiled version of a for(i=0; i<100; i++) with optimisation does get compiled as for(i=99; i>=0; i--) presumably meaning that i-- is faster than i++ but as its handled by compiler, you should be able to pretty much ignore it ! ok, back to clipping a world. how about sometyhing like this? (again off the top of my head... apologies for mistakes) #define CELLS_X (50) #define CELLS_Y (50) #define CELLS_ONSCREEN_X (10) #define CELLS_ONSCREEN_Y (10) CellType WorldArray[CELLS_X][CELLS_Y]; // in loop for clipping // x and y are basically the array index of the first visible // cell in the top left of the screen. void BlahBlahClipWorld(int x, int y) { CellType *cell; int i,j; cell = &WorldArray[x][y]; for (i=0; i<(CELLS_ONSCREEN_X; i++) { for (j=0; jspriteAddress, &otRubbishInfo, depth); cell++; } cell += CELLS_X-CELLS_ONSCREEN_X-1; } aargh, cant think straight... maybe got loads of my x and ys in the wrong order, but there you go. It does work, and its all pointer arithmetic. which is nice. it doesnt take into account clipping when you get to the edge of the world but hey, my brain hurts :) Rob