TV_640x480

mrkotfw

Member
Hi guys, i was reading up on SL_DEF.H and i saw other modes, since my sprites are 80x120 they are too big for 320x224, so i tried TV_640x480 and the size of the sprites were perect but! i got these results:

http://ss_snk_359.artheos.net/new.rar

if anyone can please try my demo on real hardware and be so kind to give me a pic of a few .. i would be so happy if it actually does work...

http://ss_snk_359.atheos.net/temp-real-hardware.bin

Code:
#include "sgl.h"

#include "sega_sys.h"

#include "SCROLL/BG1.CEL"

#include "SCROLL/BG1.MAP"

#include "SCROLL/BG1.PAL"

#include "SCROLL/VF.CEL"

#include "SCROLL/VF.MAP"

#include "SCROLL/VF.PAL"

#include "RAW/BMANI.C"

#include "RAW/LOGO.C"

#include "RAW/ZOMBIE.C"

#define WIDTH 72

#define	HEIGHT 120

#define SIZEOF 8760

#define NUM_SP 13

FIXED ang[]={

	DEGtoANG(0.0), // 1

	DEGtoANG(0.0), // 2

	DEGtoANG(0.0), // 3

	DEGtoANG(0.0), // 4

	DEGtoANG(0.0), // 5

	DEGtoANG(0.0), // 6

	DEGtoANG(0.0), // 7

	DEGtoANG(0.0), // 8

	DEGtoANG(0.0), // 9

	DEGtoANG(0.0), // 10

	DEGtoANG(0.0), // 11

	DEGtoANG(0.0), // 12

	DEGtoANG(0.0), // 13

	};

FIXED pos[][XYZS]={

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 1

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 2

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 3

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 4

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 5

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 6

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 7

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 8

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 9

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 10

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 11

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 12

	{toFIXED(-64.0),toFIXED(-16.0),toFIXED(170.0),toFIXED(1.0)}, // 13

	};

PICTURE sprite[]={

	PICDEF(0,COL_32K,Bmani),

	PICDEF(1,COL_32K,Bmani_Left),

	PICDEF(2,COL_32K,Bmani_Left2),

	PICDEF(3,COL_32K,Bmani_Right),

	PICDEF(4,COL_32K,Bmani_Right2),

	PICDEF(5,COL_32K,Bmani_Beam),

	PICDEF(6,COL_32K,Bmani_Beam2),

	PICDEF(7,COL_32K,Main_NewGame),

	PICDEF(8,COL_32K,Main_GameOver),

	PICDEF(9,COL_32K,Enemy_Zombie),

	PICDEF(10,COL_32K,Enemy_Zombie2),

	PICDEF(11,COL_32K,Enemy_ZombieBeam),

	PICDEF(12,COL_32K,Enemy_ZombieBeam2),

	};

TEXTURE texture[]={

	TEXDEF(WIDTH,HEIGHT,0), // Bmani[]; // 1

	TEXDEF(WIDTH,HEIGHT,SIZEOF* 1), // Bmani_Left[];    // 2

	TEXDEF(WIDTH,HEIGHT,SIZEOF* 2), // Bmani_Left2[];    // 3

	TEXDEF(WIDTH,HEIGHT,SIZEOF* 3), // Bmani_Right[];    // 4

	TEXDEF(WIDTH,HEIGHT,SIZEOF* 4), // Bmani_Right2[];   // 5

	TEXDEF(WIDTH,HEIGHT,SIZEOF* 5), // Bmani_Beam[];    // 6

	TEXDEF(WIDTH,HEIGHT,SIZEOF* 6), // Bmani_Beam2[];    // 7

	TEXDEF(WIDTH,HEIGHT,SIZEOF* 7), // Main_NewGame[];   // 8

	TEXDEF(WIDTH,HEIGHT,SIZEOF* 8), // Main_GameOver[];   // 9

	TEXDEF(WIDTH,HEIGHT,SIZEOF* 9), // Enemy_Zombie[];   // 10

	TEXDEF(WIDTH,HEIGHT,SIZEOF*10), // Enemy_Zombie2[];   // 11

	TEXDEF(WIDTH,HEIGHT,SIZEOF*11), // Enemy_ZombieBeam[]; // 12

	TEXDEF(WIDTH,HEIGHT,SIZEOF*12), // Enemy_ZombieBeam2[]; // 13

	};

SPR_ATTR sprite_attr[]={

	SPR_ATTRIBUTE(0,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(1,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(2,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(3,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(4,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(5,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(6,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(7,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(8,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(9,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(10,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(11,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	SPR_ATTRIBUTE(12,No_Palet,No_Gouraud,CL32KRGB|ECdis,sprNoflip),

	};

#define	RBG0RB_CEL_ADR (VDP2_VRAM_A0)

#define	RBG0RB_MAP_ADR (VDP2_VRAM_B0)

#define	RBG0RB_COL_ADR (VDP2_COLRAM+0x00200)

#define	RBG0RA_CEL_ADR (RBG0RB_CEL_ADR+0x06e80)

#define	RBG0RA_MAP_ADR (RBG0RB_MAP_ADR+0x02000)

#define	RBG0RA_COL_ADR (RBG0RB_COL_ADR+0x00200)

#define	RBG0_KTB_ADR (VDP2_VRAM_A1)

#define	RBG0_PRA_ADR (VDP2_VRAM_A1+0x1fe00)

#define	RBG0_PRB_ADR (RBG0_PRA_ADR+0x00080)

#define BACK_COL_ADR (VDP2_VRAM_A1+0x1fffe)

#define LINE_TBL_ADR (VDP2_VRAM_A1)

#define	MAP_HSIZE	1

#define	MAP_VSIZE	1

#define	MAP_UNIT	2048L

#define	S2D_PNBSIZE	PNB_1WORD

#define	S2D_COLTYPE	COL_TYPE_256

#define	S2D_CHRSIZE	CHAR_SIZE_2x2

#define	S2D_CELSIZE	4352L

#define	S2D_CEL cel_vf

#define	S2D_MAP map_vf

#define	S2D_PAL pal_vf

#define	S2D_PALSIZE	1024L

extern TEXTURE texture[];

extern PICTURE sprite[];

extern SPR_ATTR sprite_attr[];

extern FIXED pos[][];

extern FIXED ang[];

extern Uint16 cel_vf[];

extern Uint16 map_vf[];

extern Uint16 pal_vf[];

void Cel2VRAM(Uint8 *Cel_Data,void *Cell_Adr,Uint32 suu);

void Map2VRAM(Uint16 *Map_Data,void *Map_Adr,Uint16 suuj,Uint16 suui,Uint16 palnum,Uint32 mapoff);

void Pal2CRAM(Uint16 *Pal_Data,void *Col_Adr,Uint32 suu);

void LoadSprite(PICTURE *pcptr,Uint32 NbPicture);

void DisplaySprite(Int sprite);

void Player1(void);

Uint16 pad_asign[]={

	PER_DGT_KU,

	PER_DGT_KD,

	PER_DGT_KR,

	PER_DGT_KL,

	PER_DGT_TA,

	PER_DGT_TB,

	PER_DGT_TC,

	PER_DGT_ST,

	PER_DGT_TX,

	PER_DGT_TY,

	PER_DGT_TZ,

	PER_DGT_TR,

	PER_DGT_TL,

	};

	Uint16	i;

	Uint16	data;

	Uint16	tv_mode=TV_640x480;

	Uint32	*tb,l;

	Int move_left=320;

	Int move_right=320;

	Int shoot_beam=120;

	FIXED	position=toFIXED(0.0);

	FIXED	main_scr_x=toFIXED(0.0);

	FIXED	main_scr_y=toFIXED(0.0);

	ANGLE	angle=DEGtoANG(0.0);

	ANGLE	angle_up=DEGtoANG(0.0);

Int ss_main(void){

	slInitSystem((Uint16)tv_mode,texture,1);

	slColRAMMode(CRM16_2048);

	slBack1ColSet((void *)BACK_COL_ADR,C_RGB(0,0,0));

	slTVOff();

	LoadSprite(sprite,NUM_SP);

	

	slRparaInitSet((void *)RBG0_PRA_ADR);

	slMakeKtable((void *)RBG0_KTB_ADR);

	slCharRbg0(COL_TYPE_256,CHAR_SIZE_1x1);

	slPageRbg0((void *)RBG0RB_CEL_ADR,0,PNB_1WORD|CN_12BIT);

	slPlaneRA(PL_SIZE_1x1);

	sl1MapRA((void *)RBG0RA_MAP_ADR);

	slOverRA(0);

	slKtableRA((void *)RBG0_KTB_ADR,K_FIX|K_DOT|K_2WORD|K_ON);

	Cel2VRAM(tuti_cel,(void *)RBG0RA_CEL_ADR,65536);

	Map2VRAM(tuti_map,(void *)RBG0RA_MAP_ADR,64,64,2,884);

	Pal2CRAM(tuti_pal,(void *)RBG0RA_COL_ADR,160);

	slCharNbg1(S2D_COLTYPE,S2D_CHRSIZE);

	slPageNbg1((void *)RBG0RB_CEL_ADR,0,S2D_PNBSIZE);

	slPlaneNbg1(PL_SIZE_1x1);

	slMapNbg1((void *)RBG0RB_MAP_ADR,(void *)RBG0RB_MAP_ADR,(void *)RBG0RB_MAP_ADR,(void *)RBG0RB_MAP_ADR);

	slDMACopy((void*)S2D_CEL,(void*)RBG0RB_CEL_ADR,(Uint32)S2D_CELSIZE);

	slDMACopy((void*)S2D_MAP,(void*)RBG0RB_MAP_ADR,(Uint32)(MAP_HSIZE*MAP_VSIZE*MAP_UNIT));

	slDMACopy((void*)S2D_PAL,(void*)VDP2_COLRAM,(Uint32)S2D_PALSIZE);

	slLineScrollModeNbg1(lineSZ1|lineHScroll);

	tb=(Uint32*)LINE_TBL_ADR;

	for(i=0; i<512; i++)

 *tb++=16*slSin(((i&0x00ff)<<8)*0x00ff);

 slLineScrollTable1((void*)VDP2_VRAM_A1);

 i=0;

	slScrPosNbg1(main_scr_x,main_scr_y);

	slScrAutoDisp(NBG1ON|RBG0ON);

	slTVOn();

	while(1){

 Player1();

 slCurRpara(RA);

 slUnitMatrix(CURRENT);

 slTranslate(toFIXED(0.0),toFIXED(0.0)+position,toFIXED(100.0));

 slRotX(DEGtoANG(-90.0));

 slScrMatSet();

 slScrPosNbg1(main_scr_x,main_scr_y);

 slLineScrollTable1((void*)(VDP2_VRAM_A1+(i<<2)));

 i=(i+5)&0x00ff;

 slSynch();

	}

}

void Cel2VRAM(Uint8 *Cel_Data,void *Cell_Adr,Uint32 suu){

	Uint32 i;

	Uint8 *VRAM;

	VRAM=(Uint8 *)Cell_Adr;

	for(i=0; i<suu; i++){

 *(VRAM++)=*(Cel_Data++);

	}

}

void Map2VRAM(Uint16 *Map_Data,void *Map_Adr,Uint16 suuj,Uint16 suui,Uint16 palnum,Uint32 mapoff){

	Uint16 i,j;

	Uint16 paloff;

	Uint16 *VRAM;

	paloff=palnum<<12;

	VRAM=(Uint16 *)Map_Adr;

	

	for(i=0; i<suui; i++){

 for(j=0; j<suuj; j++){

 	*VRAM++=(*Map_Data|paloff)+mapoff;

  Map_Data++;

 	}

 	VRAM+=(64-suuj);

 	}

	}

void Pal2CRAM(Uint16 *Pal_Data,void *Col_Adr,Uint32 suu){

	Uint16 i;

	Uint16 *VRAM;

	VRAM=(Uint16 *)Col_Adr;

	for(i=0; i<suu; i++){

 *(VRAM++)=*(Pal_Data++);

	}

}

void LoadSprite(PICTURE *pcptr,Uint32 NbPicture){

	TEXTURE *txptr;

	for(; NbPicture-->0; pcptr++){

 txptr=texture+pcptr->texno;

 slDMACopy((void *)pcptr->pcsrc,(void *)(SpriteVRAM+((txptr->CGadr)<<3)),(Uint32)((txptr->Hsize*txptr->Vsize*4)>>(pcptr->cmode)));

 }

	}

void DisplaySprite(int sprite){

	slDispSprite((FIXED*)pos[sprite],(SPR_ATTR*)&sprite_attr[sprite].texno,DEGtoANG(ang[sprite]));

}

void Player1(void){

	data=Smpc_Peripheral[0].data;

	move_left=320;

	move_right=320;

	shoot_beam=120;

	DisplaySprite(0);

	if(!(data&(PER_DGT_KL))){

 slSynch();

 move_left-=10;

 	pos[0][0]=pos[1][0]=

 	pos[2][0]=pos[3][0]=

 	pos[4][0]=pos[5][0]=pos[6][0]+=toFIXED(10.0);

 	if(move_left==320){

  DisplaySprite(0);

 	}

  else {

  if(move_left>=(320-10*2)){

  	DisplaySprite(0);

  }

  if(move_left>=(320-10*2)){

  	slSynch();

  	DisplaySprite(1);

  }

  if(move_left>=0){

  	move_left=320;

  }

 	}

 }

	if(!(data&(PER_DGT_KR))){

 slSynch();

 move_right-=10;

 	pos[0][0]=pos[1][0]=

 	pos[2][0]=pos[3][0]=

 	pos[4][0]=pos[5][0]=pos[6][0]+=toFIXED(10.0);

 	if(move_right==320){

  DisplaySprite(0);

 	}

  else {

  if(move_right>=(320-10*2)){

  	DisplaySprite(0);

  }

  if(move_right>=(320-10*2)){

  	slSynch();

  	DisplaySprite(1);

  }

  if(move_right>=0){

  	move_left=320;

  }

 	}

 }

	if(!(data&(PER_DGT_TA))){

 slSynch();

 shoot_beam-=10;

 	pos[0][0]=pos[1][0]=

 	pos[2][0]=pos[3][0]=

 	pos[4][0]=pos[5][1]=pos[6][1]-=toFIXED(10.0);

 	if(shoot_beam>=(120-10*2)){

  DisplaySprite(5);

 	}

 	if(shoot_beam>=(120-10*2)){

  slSynch();

  DisplaySprite(6);

 	}

 	if(shoot_beam>=0){

  shoot_beam=120;

 	}

 }

	}
 
Top