Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Scott Cartier Newsgroups: scea.yaroze.programming.2d_graphics Subject: Need help with backgrounds in hi-res mode Date: Tue, 26 Aug 1997 22:14:34 -0700 Organization: SCEA News Server Lines: 132 Message-ID: <3403B7BA.1FA@concentric.net> Reply-To: dsyaroze@concentric.net NNTP-Posting-Host: ts034d15.cup-ca.concentric.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0C-GZone (Win95; I) Okay, I eliminated everything from my program except the background routines and it *still* flickers (in low-res mode it works fine). No sprites or anything else is being sorted - just the background. I really need help figuring this one out. The code is below. Any ideas (even just random thoughts) would be helpful. Thanks! Scott #define HI_RES 1 #define H_RES 320 * (HI_RES + 1) #define V_RES 240 * (HI_RES + 1) #define OT_LENGTH 4 #define MAX_SPRITES 255 #define MAX_BACKGND 64 #define MAX_CELLS 10 #define OT_LENGTH 4 GsOT WorldOT[2]; GsOT_TAG OTTags[2][1<> 4) + 1) * ((V_RES >> 4) + 1 + 1) * 6 + 4) * 2 + 2]; volatile u_char *bb0, *bb1; static u_long PadRead(long id); main() { int i, cnt, backgnd_size, backgnd_index, rand_num; int activeBuff; GsIMAGE tmp_img; RECT load_rect; for (cnt = 0; cnt < PAD_NUM_BTNS; cnt++) pad_state[cnt] = 0; SetVideoMode(MODE_NTSC); GetPadBuf(&bb0, &bb1); if (HI_RES) GsInitGraph(H_RES, V_RES, 5, 0, 0); else GsInitGraph(H_RES, V_RES, 4, 0, 0); if (HI_RES) GsDefDispBuff(0, 0, 0, 0); else GsDefDispBuff(0, 0, 0, 240); for (i = 1; i <= backgnd_data[0]; i++) { GsGetTimInfo((u_long *) backgnd_data[i] + 1, &tmp_img); load_rect.x = tmp_img.px; load_rect.y = tmp_img.py; load_rect.w = tmp_img.pw; load_rect.h = tmp_img.ph; LoadImage(&load_rect, tmp_img.pixel); load_rect.x = tmp_img.cx; load_rect.y = tmp_img.cy; load_rect.w = tmp_img.cw; load_rect.h = tmp_img.ch; LoadImage(&load_rect, tmp_img.clut); backgnd_cells[i].u = (tmp_img.px & 0x3F) << 2; backgnd_cells[i].v = tmp_img.py & 0xFF; backgnd_cells[i].cba = ((tmp_img.cx >> 4) & 0x3F) | ((tmp_img.cy & 0x3FF) << 6); backgnd_cells[i].tpage = GetTPage(0, 0, tmp_img.px, tmp_img.py); backgnd_cells[i].flag = 0; } backgnd_size = (640 / 16) * (480 / 16); // Fill array with the same tile for (backgnd_index = 0; backgnd_index < backgnd_size; backgnd_index++) backgnd_array[backgnd_index] = 1; backgnd_map.cellw = 16; backgnd_map.cellh = 16; backgnd_map.ncellw = 640 / 16; backgnd_map.ncellh = 480 / 16; backgnd_map.base = backgnd_cells; backgnd_map.index = backgnd_array; backgnd.attribute = SP_NOROTSCAL; backgnd.x = 0; backgnd.y = 0; backgnd.w = H_RES; backgnd.h = V_RES; backgnd.scrollx = 0; backgnd.scrolly = 0; backgnd.r = backgnd.g = backgnd.b = 0x80; backgnd.map = &backgnd_map; backgnd.mx = backgnd.my = 0; backgnd.scalex = backgnd.scaley = ONE; backgnd.rotate = 0; GsInitFixBg16(&backgnd, backgnd_workarea); for (i = 0; i <= 1; i++) { WorldOT[i].length = OT_LENGTH; WorldOT[i].org = OTTags[i]; } while (pad_state[PAD_SELECT] == 0) { activeBuff = GsGetActiveBuff(); GsSetWorkBase((PACKET *)GpuPacketArea[activeBuff]); GsClearOt(0, 0, &WorldOT[activeBuff]); pad_read(); GsSortFixBg16(&backgnd, backgnd_workarea, &WorldOT[activeBuff], OT_BACKGND); if (!HI_RES) DrawSync(0); cnt = VSync(0); if (HI_RES) ResetGraph(1); GsSwapDispBuff(); GsSortClear(0, 0, 0, &WorldOT[activeBuff]); GsDrawOt(&WorldOT[activeBuff]); } return(0); }