This commit is contained in:
Paul 2000-11-13 17:03:20 +00:00
parent 0e10ca164c
commit da0eac7a3d
12 changed files with 231 additions and 59 deletions

View file

@ -62,6 +62,13 @@
---------------------------------------------------------------------- */
void CScrollyBackground::init()
{
m_sprites=new ("Scrolly Background sprites") SpriteBank;
m_sprites->load(FRONTEND_FRONTEND_SPR);
m_xOff=m_yOff=0;
setSpeed(DEFAULT_X_SPEED,DEFAULT_Y_SPEED);
setSpeedScale(DEFAULT_SPEED_SCALE);
setOt(DEFAULT_OT);
}
@ -73,6 +80,7 @@ void CScrollyBackground::init()
---------------------------------------------------------------------- */
void CScrollyBackground::shutdown()
{
m_sprites->dump(); delete m_sprites; m_sprites=NULL;
}
@ -84,6 +92,27 @@ void CScrollyBackground::shutdown()
---------------------------------------------------------------------- */
void CScrollyBackground::render()
{
POLY_FT4 *ft4;
sFrameHdr *fh;
int x,y,w,h;
fh=m_sprites->getFrameHeader(FRM__BG1);
w=fh->W;
h=fh->H;
y=(m_yOff>>m_speedScale)-h;
do
{
x=(m_xOff>>m_speedScale)-w;
do
{
ft4=m_sprites->printFT4(fh,x,y,0,0,m_ot);
setSemiTrans(ft4,true);
x+=w;
}
while(x<512);
y+=h;
}
while(y<256);
}
@ -95,6 +124,12 @@ void CScrollyBackground::render()
---------------------------------------------------------------------- */
void CScrollyBackground::think(int _frames)
{
sFrameHdr *fh;
fh=m_sprites->getFrameHeader(FRM__BG1);
m_xOff=(m_xOff+(_frames*m_xSpeed))%(fh->W<<m_speedScale);
m_yOff=(m_yOff+(_frames*m_ySpeed))%(fh->H<<m_speedScale);
}

View file

@ -5,7 +5,7 @@
Author: PKG
Created:
Project: Spongebob
Purpose:
Purpose: Scrolling tiled background class
Copyright (c) 2000 Climax Development Ltd
@ -37,9 +37,25 @@ public:
void render();
void think(int _frames);
void setSpeed(int _xSpeed,int _ySpeed) {m_xSpeed=_xSpeed;m_ySpeed=_ySpeed;}
void setSpeedScale(int _speedScale) {m_speedScale=_speedScale;}
void setOt(int _ot) {m_ot=_ot;}
private:
enum
{
DEFAULT_X_SPEED=-2,
DEFAULT_Y_SPEED=-3,
DEFAULT_SPEED_SCALE=2,
DEFAULT_OT=1000,
};
class SpriteBank *m_sprites;
int m_xOff,m_yOff;
int m_xSpeed,m_ySpeed;
int m_speedScale;
int m_ot;
};

View file

@ -26,37 +26,6 @@
/*****************************************************************************/
FontBank *CGameScene::s_genericFont;
SpriteBank *CGameScene::s_sprites;
BubicleEmitterData bubData=
{
206,200,60,60, // m_x,m_y,m_w,m_h
10,1, // m_birthRate,m_birthAmount
-1, // m_life
{ // m_bubicleBase
100, // m_life
0,0,0, // m_vx,m_vdx,m_vxmax
-40,-15,-100, // m_vy,m_vdy,m_vymax
13,10, // m_w,m_h
10, // m_dvSizeChange
0,100, // m_theta,m_vtheta
100,2,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
40, // m_ot
{ 128,128,128, } // m_colour
},
{ // m_bubicleRange
100, // m_life
0,0,0, // m_vx,m_vdx,m_vxmax
20,10,0, // m_vy,m_vdy,m_vymax
5,5, // m_w,m_h
10, // m_dvSizeChange
4095,50, // m_theta,m_vtheta
100,5,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
0, // m_ot
{ 0, 64,127, } // m_colour
}
};
CBubicleEmitter *testBub;
/*****************************************************************************/
@ -71,11 +40,6 @@ void CGameScene::init()
s_genericFont->setColour( 255, 255 , 0 );
VidSetClearScreen(1);
CBubicleFactory::init();
testBub=CBubicleFactory::spawnEmitter(&bubData);
s_sprites=new ("bg sprite") SpriteBank();
s_sprites->load(INGAMEFX_INGAMEFX_SPR);
}
/*****************************************************************************/
@ -83,8 +47,6 @@ void CGameScene::init()
void CGameScene::shutdown()
{
s_genericFont->dump(); delete s_genericFont;
s_sprites->dump(); delete s_sprites;
CBubicleFactory::shutdown();
}
/*****************************************************************************/
@ -98,12 +60,6 @@ void CGameScene::render()
char *Str="Sponge\nBob\nSquare\nPants";
s_genericFont->print(X,Y,Str);
CBubicleFactory::render();
POLY_FT4 *ft4=s_sprites->printFT4(FRM_BACKGROUND,0,0,0,0,1023);
setXYWH(ft4,20,20,512-40,256-40);
setRGB0(ft4,64,64,64);
}
/*****************************************************************************/
@ -117,10 +73,6 @@ void CGameScene::think(int _frames)
if (Y<+4) {Y=0+4; Dy=getRndRange(5)+1;}
if (Y>256-64) {Y=256-64; Dy=-(getRndRange(5)+1);}
}
testBub->setPos(X,Y);
CBubicleFactory::think();
}
/*****************************************************************************/

View file

@ -86,6 +86,44 @@ s16 standardFontTab[]=
};
FontData standardFont( UI_UIGFX_SPR, standardFontTab, 9, 1,1, 4 );
s16 largeFontTab[]=
{
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
/* ! " # $ % & ' */ -1,FRM_SBFONTAN_0037,FRM_SBFONTAN_0038, -1,FRM_SBFONTAN_0052,FRM_SBFONTAN_0039,FRM_SBFONTAN_0040,FRM_SBFONTAN_0036,
/* ( ) * + , - . / */ FRM_SBFONTAN_0042,FRM_SBFONTAN_0043,FRM_SBFONTAN_0041, -1,FRM_SBFONTAN_0047,FRM_SBFONTAN_0044,FRM_SBFONTAN_0053,FRM_SBFONTAN_0050,
/* 0 1 2 3 4 5 6 7 */ FRM_SBFONTAN_0026,FRM_SBFONTAN_0027,FRM_SBFONTAN_0028,FRM_SBFONTAN_0029,FRM_SBFONTAN_0030,FRM_SBFONTAN_0031,FRM_SBFONTAN_0032,FRM_SBFONTAN_0033,
/* 8 9 : ; < = > ? */ FRM_SBFONTAN_0034,FRM_SBFONTAN_0035,FRM_SBFONTAN_0045,FRM_SBFONTAN_0046, -1, -1, -1,FRM_SBFONTAN_0048,
/* @ A B C D E F G */ -1,FRM_SBFONTAN_0000,FRM_SBFONTAN_0001,FRM_SBFONTAN_0002,FRM_SBFONTAN_0003,FRM_SBFONTAN_0004,FRM_SBFONTAN_0005,FRM_SBFONTAN_0006,
/* H I J K L M N O */ FRM_SBFONTAN_0007,FRM_SBFONTAN_0008,FRM_SBFONTAN_0009,FRM_SBFONTAN_0010,FRM_SBFONTAN_0011,FRM_SBFONTAN_0012,FRM_SBFONTAN_0013,FRM_SBFONTAN_0014,
/* P Q R S T U V W */ FRM_SBFONTAN_0015,FRM_SBFONTAN_0016,FRM_SBFONTAN_0017,FRM_SBFONTAN_0018,FRM_SBFONTAN_0019,FRM_SBFONTAN_0020,FRM_SBFONTAN_0021,FRM_SBFONTAN_0022,
/* X Y Z [ \ ] ^ _ */ FRM_SBFONTAN_0023,FRM_SBFONTAN_0024,FRM_SBFONTAN_0025,FRM_SBFONTAN_0054,FRM_SBFONTAN_0049,FRM_SBFONTAN_0055, -1, -1,
/* ` a b c d e f g */ -1,FRM_SBFONTAN_0056,FRM_SBFONTAN_0057,FRM_SBFONTAN_0058,FRM_SBFONTAN_0059,FRM_SBFONTAN_0060,FRM_SBFONTAN_0061,FRM_SBFONTAN_0062,
/* h i j k l m n o */ FRM_SBFONTAN_0063,FRM_SBFONTAN_0064,FRM_SBFONTAN_0065,FRM_SBFONTAN_0066,FRM_SBFONTAN_0067,FRM_SBFONTAN_0068,FRM_SBFONTAN_0069,FRM_SBFONTAN_0070,
/* p q r s t u v w */ FRM_SBFONTAN_0071,FRM_SBFONTAN_0072,FRM_SBFONTAN_0073,FRM_SBFONTAN_0074,FRM_SBFONTAN_0075,FRM_SBFONTAN_0076,FRM_SBFONTAN_0077,FRM_SBFONTAN_0078,
/* x y z { | } ~ . */ FRM_SBFONTAN_0079,FRM_SBFONTAN_0080,FRM_SBFONTAN_0081, -1, -1, -1, -1, -1,
/* € <20> ƒ „ … † ‡ */ -1, -1, -1, -1, -1, -1, -1, -1,
/* ˆ ‰ Š Œ <20> Ž <20> */ -1, -1, -1, -1, -1, -1, -1, -1,
/* <20> “ ” • — */ -1, -1, -1, -1, -1, -1, -1, -1,
/* ˜ ™ š œ <20> ž Ÿ */ -1, -1, -1, -1, -1, -1, -1, -1
/*   ¡ ¢ £ ¤ ¥ ¦ § */ -1, -1, -1, -1, -1, -1, -1, -1,
/* ¨ © ª « ¬ ­ ® ¯ */ -1, -1, -1, -1, -1, -1, -1, -1,
/* ° ± ² ³ ´ µ ¶ · */ -1, -1, -1, -1, -1, -1, -1, -1,
/* ¸ ¹ º » ¼ ½ ¾ ¿ */ -1, -1, -1, -1, -1, -1, -1, -1,
-1,-1,
/* À Á Â Ã Ä Å Æ Ç */ FRM_SBFONTAN_0084,FRM_SBFONTAN_0085,FRM_SBFONTAN_0086,FRM_SBFONTAN_0087,FRM_SBFONTAN_0088,FRM_SBFONTAN_0089,FRM_SBFONTAN_0090,FRM_SBFONTAN_0091,
/* È É Ê Ë Ì Í Î Ï */ FRM_SBFONTAN_0092,FRM_SBFONTAN_0093,FRM_SBFONTAN_0094,FRM_SBFONTAN_0095,FRM_SBFONTAN_0096,FRM_SBFONTAN_0097,FRM_SBFONTAN_0098,FRM_SBFONTAN_0099,
/* Ð Ñ Ò Ó Ô Õ Ö × */ FRM_SBFONTAN_0100,FRM_SBFONTAN_0101,FRM_SBFONTAN_0102,FRM_SBFONTAN_0103,FRM_SBFONTAN_0104,FRM_SBFONTAN_0105,FRM_SBFONTAN_0106,FRM_SBFONTAN_0107,
/* Ø Ù Ú Û Ü Ý Þ ß */ FRM_SBFONTAN_0108,FRM_SBFONTAN_0109,FRM_SBFONTAN_0110,FRM_SBFONTAN_0111,FRM_SBFONTAN_0112,FRM_SBFONTAN_0113,FRM_SBFONTAN_0114,FRM_SBFONTAN_0115,
/* à á â ã ä å æ ç */ FRM_SBFONTAN_0116,FRM_SBFONTAN_0117,FRM_SBFONTAN_0118,FRM_SBFONTAN_0119,FRM_SBFONTAN_0120,FRM_SBFONTAN_0121,FRM_SBFONTAN_0122,FRM_SBFONTAN_0123,
/* è é ê ë ì í î ï */ FRM_SBFONTAN_0124,FRM_SBFONTAN_0125,FRM_SBFONTAN_0126,FRM_SBFONTAN_0127,FRM_SBFONTAN_0128,FRM_SBFONTAN_0129,FRM_SBFONTAN_0130,FRM_SBFONTAN_0131,
/* ð ñ ò ó ô õ ö ÷ */ FRM_SBFONTAN_0132,FRM_SBFONTAN_0133, -1, -1, -1, -1, -1, -1,
/* ø ù ú û ü ý þ ÿ */ -1, -1, -1, -1, -1, -1, -1, -1,
};
FontData largeFont( UI_UIGFX_SPR, largeFontTab, 19, 1,1, 6 );
/*----------------------------------------------------------------------
Function:

View file

@ -58,7 +58,8 @@ public:
---- */
// Available fonts
extern FontData standardFont;
extern FontData standardFont; // Crappy old PR font
extern FontData largeFont; // Large SB font
/* Data
---- */

View file

@ -278,7 +278,7 @@ void CGUIObjectWithFont::init(CGUIObject *_parent,GUIId _id)
{
CGUIObject::init(_parent,_id);
m_fontBank=new ("GUIObjectWithFont:fontBank") FontBank();
m_fontBank->initialise(&standardFont);
m_fontBank->initialise(&largeFont);
m_fontBank->setJustification(FontBank::JUST_CENTRE);
m_fontBank->setOt(getOt());
m_fontBank->setColour(DEFAULT_FONT_R,DEFAULT_FONT_G,DEFAULT_FONT_B);

View file

@ -74,6 +74,10 @@
#include "locale\textdbase.h"
#endif
#ifndef __FRONTEND_SCROLLBG_H__
#include "frontend\scrollbg.h"
#endif
/* Std Lib
------- */
@ -102,6 +106,9 @@
Vars
---- */
static FontBank s_fontBank;
static CScrollyBackground *s_bg1;
static CScrollyBackground *s_bg2;
static CScrollyBackground *s_bg3;
/*----------------------------------------------------------------------
@ -229,9 +236,25 @@ PAUL_DBGMSG("initial mem free=%d",mem);
// baseGUIObject=0;
PAUL_DBGMSG("change=%d",mem-(MainRam.TotalRam-MainRam.RamUsed));
s_bg1=new ("scrolly background") CScrollyBackground();
s_bg1->init();
s_bg1->setSpeed(+2,+2);
s_bg2=new ("scrolly background") CScrollyBackground();
s_bg2->init();
s_bg2->setSpeed(-2,0);
s_bg2->setOt(1001);
s_bg3=new ("scrolly background") CScrollyBackground();
s_bg3->init();
s_bg3->setSpeed(0,-2);
s_bg3->setOt(1002);
}
/*----------------------------------------------------------------------
Function:
Purpose:
@ -240,6 +263,9 @@ PAUL_DBGMSG("change=%d",mem-(MainRam.TotalRam-MainRam.RamUsed));
---------------------------------------------------------------------- */
void CPaulScene::shutdown()
{
s_bg3->shutdown();
s_bg2->shutdown();
s_bg1->shutdown();
s_fontBank.dump();
}
@ -253,7 +279,7 @@ void CPaulScene::shutdown()
int showDebugLog=false;
void CPaulScene::render()
{
/*
if(showDebugLog)
{
int logCount;
@ -270,6 +296,11 @@ void CPaulScene::render()
if(baseGUIObject)
baseGUIObject->render();
s_bg1->render();
s_bg2->render();
s_bg3->render();
*/
}
@ -291,8 +322,59 @@ void CPaulScene::think(int _frames)
if(baseGUIObject)
baseGUIObject->think(_frames);
s_bg1->think(_frames);
s_bg2->think(_frames);
s_bg3->think(_frames);
}
/*===========================================================================
end */
end */
/*
BubicleEmitterData bubData=
{
206,200,60,60, // m_x,m_y,m_w,m_h
10,1, // m_birthRate,m_birthAmount
-1, // m_life
{ // m_bubicleBase
100, // m_life
0,0,0, // m_vx,m_vdx,m_vxmax
-40,-15,-100, // m_vy,m_vdy,m_vymax
13,10, // m_w,m_h
10, // m_dvSizeChange
0,100, // m_theta,m_vtheta
100,2,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
40, // m_ot
{ 128,128,128, } // m_colour
},
{ // m_bubicleRange
100, // m_life
0,0,0, // m_vx,m_vdx,m_vxmax
20,10,0, // m_vy,m_vdy,m_vymax
5,5, // m_w,m_h
10, // m_dvSizeChange
4095,50, // m_theta,m_vtheta
100,5,0, // m_wobbleWidth,m_vwobbleWidth,m_vdwobbleWidth
0, // m_ot
{ 0, 64,127, } // m_colour
}
};
CBubicleEmitter *testBub;
CBubicleFactory::init();
testBub=CBubicleFactory::spawnEmitter(&bubData);
CBubicleFactory::shutdown();
testBub->setPos(X,Y);
CBubicleFactory::render();
CBubicleFactory::think();
*/