From 96801c6b4cdb9fc7a5459c5ca5db689db8443185 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 19 Jun 2001 18:41:29 +0000 Subject: [PATCH] --- source/backend/party.cpp | 149 ++++++++++++++++++++++----------------- 1 file changed, 85 insertions(+), 64 deletions(-) diff --git a/source/backend/party.cpp b/source/backend/party.cpp index 44cf0a23b..ba00f8379 100644 --- a/source/backend/party.cpp +++ b/source/backend/party.cpp @@ -62,6 +62,10 @@ #include "frontend\frontend.h" #endif +#ifndef __MATHTABLE_HEADER__ +#include "utils\mathtab.h" +#endif + /* Std Lib ------- */ @@ -94,6 +98,8 @@ Vars ---- */ +static int s_leftBobSin,s_leftBob,s_rightBobSin,s_rightBob; + CPartyScene PartyScene; CActorGfx *m_actorSpongebob; @@ -130,6 +136,8 @@ void CPartyScene::init() m_actorPatrick->SetOtPos(5); CActorPool::SetUpCache(); CActorPool::CleanUpCache(); + + s_leftBobSin=s_leftBob=s_rightBobSin=s_rightBob=0; } @@ -163,82 +171,83 @@ typedef struct CShopScene::SHOPITEM_ID m_itemId; int m_fh; u8 m_xOffsetBroken,m_yOffsetBroken; + int *m_extraYOffset; u8 m_flipX; u8 m_ot; u8 m_elementId; }PARTY_IMAGE; static PARTY_IMAGE images[]= { - { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS1, 0,0, false, 2, 0 }, - { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS2, 2,0, false, 2, 0 }, - { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS3, 0,0, false, 2, 0 }, - { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS4, 0,0, false, 2, 0 }, - { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS5, 0,0, false, 2, 0 }, - { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS6, 1,0, false, 2, 0 }, - { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS7, 1,0, false, 2, 0 }, - { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS8, 2,0, false, 2, 0 }, + { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS1, 0,0, &s_leftBob, false, 2, 0 }, + { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS2, 2,0, &s_rightBob, false, 2, 0 }, + { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS3, 0,0, &s_leftBob, false, 2, 0 }, + { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS4, 0,0, &s_leftBob, false, 2, 0 }, + { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS5, 0,0, &s_leftBob, false, 2, 0 }, + { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS6, 1,0, &s_rightBob, false, 2, 0 }, + { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS7, 1,0, &s_rightBob, false, 2, 0 }, + { CShopScene::SHOPITEM_BLOWER, FRM_BALLOONS8, 2,0, &s_rightBob, false, 2, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER1, 0,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER2, 0,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER3, 1,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER4, 1,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER5, 1,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER6, 2,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER7, 2,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS1, 1,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS2, 1,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS3, 0,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS4, 0,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS5, 0,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS6, 0,0, false, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS1, 1,0, true, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS2, 1,0, true, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS3, 2,0, true, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS4, 2,0, true, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS5, 2,0, true, 1, 0 }, - { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS6, 2,0, true, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER1, 0,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER2, 0,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER3, 1,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER4, 1,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER5, 1,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER6, 2,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_BANNER7, 2,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS1, 1,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS2, 1,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS3, 0,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS4, 0,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS5, 0,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS6, 0,0, NULL, false, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS1, 1,0, NULL, true, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS2, 1,0, NULL, true, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS3, 2,0, NULL, true, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS4, 2,0, NULL, true, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS5, 2,0, NULL, true, 1, 0 }, + { CShopScene::SHOPITEM_PARTYHAT, FRM_STREAMERS6, 2,0, NULL, true, 1, 0 }, - { CShopScene::SHOPITEM_CAKE, FRM_BIGCAKE, 1,1, false, 4, 0 }, - { CShopScene::SHOPITEM_CAKE, FRM_SLICEOFCAKE, 1,1, false, 4, 0 }, - { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT1, 1,1, false, 5, 1 }, - { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT2, 1,1, false, 5, 2 }, - { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT3, 1,1, false, 5, 3 }, - { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT4, 1,1, false, 5, 4 }, - { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT5, 1,1, false, 5, 5 }, - { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT6, 1,1, false, 5, 6 }, - { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT7, 1,1, false, 5, 7 }, + { CShopScene::SHOPITEM_CAKE, FRM_BIGCAKE, 1,1, NULL, false, 4, 0 }, + { CShopScene::SHOPITEM_CAKE, FRM_SLICEOFCAKE, 1,1, NULL, false, 4, 0 }, + { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT1, 1,1, NULL, false, 5, 1 }, + { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT2, 1,1, NULL, false, 5, 2 }, + { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT3, 1,1, NULL, false, 5, 3 }, + { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT4, 1,1, NULL, false, 5, 4 }, + { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT5, 1,1, NULL, false, 5, 5 }, + { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT6, 1,1, NULL, false, 5, 6 }, + { CShopScene::SHOPITEM_CAKE, FRM_TABLEFRONT7, 1,1, NULL, false, 5, 7 }, - { CShopScene::SHOPITEM_JELLY2, FRM_JELLY, 1,1, false, 3, 0 }, - { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT1, 1,1, false, 5, 1 }, - { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT2, 1,1, false, 5, 2 }, - { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT3, 1,1, false, 5, 3 }, - { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT4, 1,1, false, 5, 4 }, - { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT5, 1,1, false, 5, 5 }, - { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT6, 1,1, false, 5, 6 }, - { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT7, 1,1, false, 5, 7 }, + { CShopScene::SHOPITEM_JELLY2, FRM_JELLY, 1,1, NULL, false, 3, 0 }, + { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT1, 1,1, NULL, false, 5, 1 }, + { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT2, 1,1, NULL, false, 5, 2 }, + { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT3, 1,1, NULL, false, 5, 3 }, + { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT4, 1,1, NULL, false, 5, 4 }, + { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT5, 1,1, NULL, false, 5, 5 }, + { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT6, 1,1, NULL, false, 5, 6 }, + { CShopScene::SHOPITEM_JELLY2, FRM_TABLEFRONT7, 1,1, NULL, false, 5, 7 }, - { CShopScene::SHOPITEM_PREZZIE, FRM_PRESSIES1, 0,1, false, 4, 0 }, - { CShopScene::SHOPITEM_PREZZIE, FRM_PRESSIES2, 0,1, false, 4, 0 }, - { CShopScene::SHOPITEM_PREZZIE, FRM_PRESSIES3, 2,1, false, 4, 0 }, - { CShopScene::SHOPITEM_PREZZIE, FRM_PRESSIES4, 2,1, false, 4, 0 }, + { CShopScene::SHOPITEM_PREZZIE, FRM_PRESSIES1, 0,1, NULL, false, 4, 0 }, + { CShopScene::SHOPITEM_PREZZIE, FRM_PRESSIES2, 0,1, NULL, false, 4, 0 }, + { CShopScene::SHOPITEM_PREZZIE, FRM_PRESSIES3, 2,1, NULL, false, 4, 0 }, + { CShopScene::SHOPITEM_PREZZIE, FRM_PRESSIES4, 2,1, NULL, false, 4, 0 }, - { CShopScene::SHOPITEM_SARNIE, FRM_CUCUMBERSARNIES, 0,1, false, 5, 0 }, - { CShopScene::SHOPITEM_SARNIE, FRM_TABLESIDE1, 0,1, false, 5, 0 }, - { CShopScene::SHOPITEM_SARNIE, FRM_TABLESIDE2, 0,1, false, 5, 0 }, - { CShopScene::SHOPITEM_SARNIE, FRM_TABLESIDE3, 0,1, false, 5, 0 }, + { CShopScene::SHOPITEM_SARNIE, FRM_CUCUMBERSARNIES, 0,1, NULL, false, 5, 0 }, + { CShopScene::SHOPITEM_SARNIE, FRM_TABLESIDE1, 0,1, NULL, false, 5, 0 }, + { CShopScene::SHOPITEM_SARNIE, FRM_TABLESIDE2, 0,1, NULL, false, 5, 0 }, + { CShopScene::SHOPITEM_SARNIE, FRM_TABLESIDE3, 0,1, NULL, false, 5, 0 }, - { CShopScene::SHOPITEM_CUPCAKE, FRM_CHERRYCAKES, 1,1, false, 4, 0 }, - { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT1, 1,1, false, 5, 1 }, - { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT2, 1,1, false, 5, 2 }, - { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT3, 1,1, false, 5, 3 }, - { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT4, 1,1, false, 5, 4 }, - { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT5, 1,1, false, 5, 5 }, - { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT6, 1,1, false, 5, 6 }, - { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT7, 1,1, false, 5, 7 }, + { CShopScene::SHOPITEM_CUPCAKE, FRM_CHERRYCAKES, 1,1, NULL, false, 4, 0 }, + { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT1, 1,1, NULL, false, 5, 1 }, + { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT2, 1,1, NULL, false, 5, 2 }, + { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT3, 1,1, NULL, false, 5, 3 }, + { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT4, 1,1, NULL, false, 5, 4 }, + { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT5, 1,1, NULL, false, 5, 5 }, + { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT6, 1,1, NULL, false, 5, 6 }, + { CShopScene::SHOPITEM_CUPCAKE, FRM_TABLEFRONT7, 1,1, NULL, false, 5, 7 }, - { CShopScene::SHOPITEM_TEDDY, FRM_SOFTTOYS1, 1,1, false, 6, 0 }, - { CShopScene::SHOPITEM_TEDDY, FRM_SOFTTOYS2, 1,0, false, 6, 0 }, - { CShopScene::SHOPITEM_TEDDY, FRM_SOFTTOYS3, 2,1, false, 6, 0 }, + { CShopScene::SHOPITEM_TEDDY, FRM_SOFTTOYS1, 1,1, NULL, false, 6, 0 }, + { CShopScene::SHOPITEM_TEDDY, FRM_SOFTTOYS2, 1,0, NULL, false, 6, 0 }, + { CShopScene::SHOPITEM_TEDDY, FRM_SOFTTOYS3, 2,1, NULL, false, 6, 0 }, }; static const int numimages=sizeof(images)/sizeof(PARTY_IMAGE); @@ -265,7 +274,14 @@ void CPartyScene::render() ASSERT(pimage->m_fh<=FRM_TABLESIDE3); if(gameSlot->isPartyItemHeld(pimage->m_itemId)&&!drawn[pimage->m_elementId]) { - m_sprites->printFT4(pimage->m_fh,pimage->m_xOffsetBroken*256,pimage->m_yOffsetBroken*256,pimage->m_flipX,0,pimage->m_ot); + int x,y; + x=pimage->m_xOffsetBroken*256; + y=pimage->m_yOffsetBroken*256; + if(pimage->m_extraYOffset) + { + y+=*pimage->m_extraYOffset; + } + m_sprites->printFT4(pimage->m_fh,x,y,pimage->m_flipX,0,pimage->m_ot); if(pimage->m_elementId) { drawn[pimage->m_elementId]=true; @@ -301,6 +317,11 @@ void CPartyScene::think(int _frames) GameState::setNextScene(&FrontEndScene); } } + + s_leftBobSin=(s_leftBobSin+(_frames*20))&4095; + s_rightBobSin=(s_rightBobSin+(_frames*16))&4095; + s_leftBob=(msin(s_leftBobSin)*2)>>12; + s_rightBob=(msin(s_rightBobSin)*2)>>12; }