Path: chuka.playstation.co.uk!news From: "Jon Prestidge (Moose)" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Destruction Of Arrays.... Date: Mon, 27 Mar 2000 21:30:01 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 87 Message-ID: <8bogd9$fon1@chuka.playstation.co.uk> References: <38DBC707.49543F25@chilternmag.demon.co.uk> <8bh0kg$7291@chuka.playstation.co.uk> <38DE47BA.331E1477@chilternmag.demon.co.uk> NNTP-Posting-Host: host5-99-56-194.btinternet.com X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Hello Chris ... this is the best I can think of... hope it's OK.... Since you're dealing with a layout (if I've got that right) and it looks like the numbers seem to be organised mostly in blocks and lines, perhaps this might be a reasonable way to do it. Ofcourse you know the format of your own layouts better so perhaps there are ways to reduce the work further (if say all walls start and end with a special number, or if some number could be placed automatically/randomly). (by the way what happens when to set a u_short to -1 ... does it turn into FFFF?) I've defined some of your example in the below code. I've not had time to test it so there may be a bug or two. Jon ----------------------- #define LAYOUT_WIDTH 20 #define LAYOUT_HEIGHT 128 // Set the whole level with the most common value or background... set_block( -1, 0, 0, LAYOUT_WIDTH, LAYOUT_HEIGHT, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); // Set blocks of values... // num x y w h set_block( 0, 4, 5, 13, 39, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); set_block( 24, 6, 6, 8, 1, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); set_block( 9, 16, 6, 1, 5, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); set_block( 24, 5, 6, 8, 1, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); set_block( -1, 4, 5, 1, 1, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); set_block( 11, 5, 5, 1, 1, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); set_block( 11, 4, 6, 1, 1, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); set_block( 28, 5, 6, 1, 1, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); set_block( 19, 14, 6, 1, 1, LAYOUT_WIDTH, s_level1, &s_level1[NUM_TILES2-1] ); ------------------------- void set_block( u_short value, long x, long y, long width, long height, long whole_width, u_short *start_address, u_short *max_address ) { // Where 'x' and 'y' start at zero ( as apposed to starting at one ). u_short *pointer; long i, j, gap; pointer = start_address; pointer += y * whole_width; pointer += x; gap = whole_width - width; if ( gap < 0 ) { printf( "Error bad width" ); return; } for ( i = 0; i < height; i++ ) { for ( j = 0; j < width; j++, pointer++ ) { if ( pointer > max_address ) { printf( "Error block overflow" ); return; } *pointer = value; } pointer += gap; } } }