summaryrefslogtreecommitdiff
path: root/sdl-test
diff options
context:
space:
mode:
authorDamien Appert <dappert>2010-11-19 11:31:12 +0000
committerDamien Appert <dappert>2010-11-19 11:31:12 +0000
commit5df4960c605a4fa7cdb3283729d8b611ea8508c9 (patch)
tree6e41fd620fea3be1f1a36719acada78802ffd998 /sdl-test
parent5f736ad433a58a09417dcf941d1e54fe5677214d (diff)
download2010-netlemmings-5df4960c605a4fa7cdb3283729d8b611ea8508c9.tar.gz
2010-netlemmings-5df4960c605a4fa7cdb3283729d8b611ea8508c9.tar.bz2
2010-netlemmings-5df4960c605a4fa7cdb3283729d8b611ea8508c9.zip
bomber and blocker + rafresh
git-svn-id: file:///var/svn/2010-netlemmings/trunk@162 077b3477-7977-48bd-8428-443f22f7bfda
Diffstat (limited to 'sdl-test')
-rw-r--r--sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c95
-rw-r--r--sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy13
2 files changed, 71 insertions, 37 deletions
diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c b/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c
index aa3f15a..6d9386c 100644
--- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c
+++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c
@@ -31,8 +31,8 @@ struct listeSimplementChainee* rev_listeO (struct listeSimplementChainee* liste)
// returne le state de l'oblet a afficher
int anim_objet(int typeS, int typeO, int cptFps, int frames, int *cpt, struct gameInit *gInit){
int f=0;
- if(typeS == 90){typeS=1;}// 4 //Lemming anim continue
- if(typeS == 91){typeS=2;}// 5 //Lemming anim at once
+ if(typeS == 90){typeS=4;}// 4 //Lemming anim continue
+ if(typeS == 91){typeS=5;}// 5 //Lemming anim at once
switch(typeS){
// not animed
case 0 : break;//f=0
@@ -897,7 +897,12 @@ int stateLemming(struct gameInit *gInit){
{k->ID=0;}//WALKER;
// conversion to faller or walker -> erase stopper mask
// Mask m = lemmings[getOrdinal(Type.STOPPER)].getMask(dir);
- // m.clearType(maskX,maskY,0,Stencil.MSK_STOPPER);
+ // m.clearType(maskX,maskY,0,Stencil.MSK_STOPPER);
+ to.w=(fx+fs-sfT->w/2)*2;
+ to.h=fy+1;
+ to.y=k->y-2;
+ to.x=k->x+sfT->w-fx-fs;
+ test_FillRect(pStencil, &to, ccc_bgStencil,0);
} else {
k->data.pl->cptFall=0;
}
@@ -936,7 +941,8 @@ int stateLemming(struct gameInit *gInit){
if(err==114){return 114;}
if(err==1) {k->ID=17;}
if(k->data.pl->cptState==(0/*gInit->mapI.lemmingDATA[10].state*/)){//16){
- k->y-=8;//gInit->mapI.lemmingDATA[10].footY-gInit->mapI.lemmingDATA[0].footY;
+ k->y-=8;
+ k->data.pl->bomber = -2;
err=ereasePx(k->x,k->y,gInit->mapI.map.tabGif[10],gInit->mapI.map.cmap.bgColor);
if(err!=0){return err;}
//TODO
@@ -3412,7 +3418,7 @@ int mouse_action (struct gameInit *gInit, int x, int y, int camX, int camY ){
}
//SPEED ; BOOST FPS
if(numB==12){
- gInit->tps.boostFps=((gInit->tps.boostFps > FPS)? gInit->tps.boostFps - 4*FPS : gInit->tps.boostFps + 4*FPS );
+ gInit->tps.boostFps=((gInit->tps.boostFps > FPS)? 0 : 4*FPS );
}
for(i=0;i<NBR_BUTTON_LEMMING;++i){
@@ -3442,12 +3448,16 @@ int mouse_action (struct gameInit *gInit, int x, int y, int camX, int camY ){
int supprLem (struct gameInit *gInit, int cptFps){
struct listeSimplementChainee *k=NULL;
SDL_Rect rect;
+
// refresh liste all of 100 tick
- if(cptFps % 100 == 0)
- {
+ //if(cptFps % 100 == 0)
+ //{
+
k=gInit->l.ll;
+
if((k != NULL)&&(gInit->l.nbr == 1)){
- if((k->data.pl->cptState != 0 ) || (k->ID != 18)){
+
+ if((k->data.pl->bomber != -2 )&&((k->data.pl->cptState != 0 ) || (k->ID != 18))){
// Restauration de la map
rect.x=k->data.pl->oldX;
rect.y=k->data.pl->oldY;
@@ -3464,6 +3474,14 @@ int supprLem (struct gameInit *gInit, int cptFps){
//test_blit(pTerrain,&rect, pSpr_Lem, &rect,0);
test_blit(pSprLemBack,&rect, k->data.pl->imgF, NULL,0);
//test_blit(pSpr_Lem,&rect, k->data.pl->imgF, NULL,0);
+ } else {
+ if (k->data.pl->bomber == -2 ){
+ rect.w = 22;
+ rect.h = 22;
+ rect.x = k->x + 6;
+ rect.y = k->y + 7;
+ test_FillRect(pSpr_Lem, &rect, gInit->mapI.map.cmap.bgColor,0);
+ }
}
if(k->ID == 17){++gInit->l.nbrDied; --gInit->l.nbr;}
@@ -3471,7 +3489,36 @@ int supprLem (struct gameInit *gInit, int cptFps){
if((k->ID == 17)||(k->ID == 19)) {k=NULL;}
} else {
while(k != NULL){
+
+
+ if((k->data.pl->bomber != -2 )&&((k->data.pl->cptState != 0 ) || (k->ID != 18))){
+ // Restauration de la map
+ rect.x=k->data.pl->oldX;
+ rect.y=k->data.pl->oldY;
+ rect.w=k->data.pl->imgF->w;
+ rect.h=k->data.pl->imgF->h;
+ test_blit(k->data.pl->imgF,NULL, pSpr_Lem, &rect,0);
+
+ // Sauvegarde de la map suivante
+ k->data.pl->oldX=k->x - DECALLE_X;
+ k->data.pl->oldY=k->y - DECALLE_Y;
+ rect.x=k->data.pl->oldX;
+ rect.y=k->data.pl->oldY;
+ test_blit(pSprLemBack,&rect, k->data.pl->imgF, NULL,0);
+ } else {
+ if (k->data.pl->bomber == -2 ){
+ rect.w = 22;
+ rect.h = 22;
+ rect.x = k->x + 6;
+ rect.y = k->y + 7;
+ test_FillRect(pSpr_Lem, &rect, gInit->mapI.map.cmap.bgColor,0);
+ }
+ }
+
if(k->next != NULL){
+
+
+
switch(k->next->ID){
// DIED
case 17 : {
@@ -3495,31 +3542,7 @@ int supprLem (struct gameInit *gInit, int cptFps){
}
}
//-DEBUG-printf("nbrInput = %d\nnbrInGame = %d\nnbrDied = %d\nnbrSafe = %d\n",gInit->l.nbrInput,gInit->l.nbr,gInit->l.nbrDied,gInit->l.nbrSafe);
- } else {
- k=gInit->l.ll;
- while ( k !=NULL ) {
- if((k->data.pl->cptState != 0 ) || (k->ID != 18)){
- // Restauration de la map
- rect.x=k->data.pl->oldX;
- rect.y=k->data.pl->oldY;
- rect.w=k->data.pl->imgF->w;
- rect.h=k->data.pl->imgF->h;
- test_blit(k->data.pl->imgF,NULL, pSpr_Lem, &rect,0);
-
- // Sauvegarde de la map suivante
- k->data.pl->oldX=k->x - DECALLE_X;
- k->data.pl->oldY=k->y - DECALLE_Y;
- rect.x=k->data.pl->oldX;
- rect.y=k->data.pl->oldY;
- //test_FillRect(pSpr_Lem, &rect, gInit->mapI.map.cmap.bgColor,0);
- //test_blit(pTerrain,&rect, pSpr_Lem, &rect,0);
- test_blit(pSprLemBack,&rect, k->data.pl->imgF, NULL,0);
- //test_blit(pSpr_Lem,&rect, k->data.pl->imgF, NULL,0);
- }
- k=k->next;
- }
- }
return 0;
}
@@ -3607,8 +3630,8 @@ int lancement (){
float fps = 0.0;
int fps_count = 0;
int fps_start = 0;
- float zoomX=0.10;
- float zoomY=0.10;
+ float zoomX=5.0;
+ float zoomY=5.0;
int switchMiniMapMode=0;
int permission=0;
//La structure d'evenement
@@ -3729,8 +3752,8 @@ int lancement (){
while( SDL_PollEvent( &event ) )
{
switch(event.key.keysym.sym){
- case SDLK_HOME : gInit.tps.boostFps = 0; break;
- case SDLK_END : gInit.tps.boostFps = FPS-11; break;
+ case SDLK_HOME : gInit.tps.boostFps = 500-FPS; break;
+ case SDLK_END : gInit.tps.boostFps = -(FPS-11); break;
case SDLK_PAGEUP : if(gInit.tps.boostFps>0){gInit.tps.boostFps -=1;}break;
case SDLK_PAGEDOWN : if(gInit.tps.boostFps<(FPS-1)){gInit.tps.boostFps +=1;}break;
case SDLK_w : paint_stencil= (paint_stencil==0)? 1 : ((paint_stencil==1)? 2 : ((paint_stencil==2)? 3 : 0)) ;permission=0;break;
diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy b/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy
index 69628cc..23fa518 100644
--- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy
+++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy
@@ -12,7 +12,7 @@
#include <stdlib.h>
/** time per frame in microseconds - this is the timing everything else is based on */
-#define FPS 30
+#define FPS 25
/** redraw animated level obejcts every 3rd frame (about 100ms) */
#define ANIM_STEP_FPS 3
@@ -27,6 +27,17 @@
// DECALLEMX est utilisé ici pour effacer le cote gauche du lemming
#define DECALLE_X 1
+// V(13,8) dans le repère xOy du mask_10.gif = position des pixel du lemming ("rectangle circonscrit")
+// V(0,-8) dans le repère des gif, on doit translater le mask_10.gif avec V pour bien centrer l'explosion
+// donc pour l'explosion déclancher dans stateLemming on applique la translation.
+// puis pour effacer le lemming à l'interieur on pose un rectancle de la couleur du background
+// pour des raisons d'anticipation de bug j'augmente la taille du rectangle
+// tel que rect.w = 22
+// rect.h = 22
+// rect.x = k->x + 6; (13 - 7 (où 7 : anticipation de bug ) )
+// rect.y = k->y + 7; (on fait la translation inverse - 1 (où 1 : anticipation de bug ) )
+
+
// the original formula is: release lemming every 4+(99-speed)/2 time steps
// where one step is 60ms (3s/50) or 66ms (4s/60).
// Lemmini runs at 30ms/33ms, so the term has to be multiplied by 2