1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Originally by Joshua Oreman, improved by Prashant Varanasi
11 * Ported to Rockbox by Ben Basha (Paprica)
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
25 #include "lib/configfile.h"
26 #include "lib/helper.h"
32 - Make original speed and further increases in speed depend more on screen size
33 - attempt to make the tunnels get narrower as the game goes on
34 - make the chopper look better, maybe a picture, and scale according
36 - use textures for the color screens for background and terrain,
37 eg stars on background
38 - allow choice of different levels [later: different screen themes]
39 - better high score handling, improved screen etc.
42 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
44 #define QUIT BUTTON_OFF
45 #define ACTION BUTTON_UP
46 #define ACTION2 BUTTON_SELECT
47 #define ACTIONTEXT "SELECT"
49 #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
50 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
51 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
53 #define QUIT BUTTON_MENU
54 #define ACTION BUTTON_SELECT
55 #define ACTIONTEXT "SELECT"
57 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD /* grayscale at the moment */
59 #define QUIT BUTTON_POWER
60 #define ACTION BUTTON_UP
61 #define ACTION2 BUTTON_SELECT
62 #define ACTIONTEXT "SELECT"
64 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
65 #define QUIT BUTTON_POWER
66 #define ACTION BUTTON_RIGHT
67 #define ACTIONTEXT "RIGHT"
69 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
70 (CONFIG_KEYPAD == SANSA_C200_PAD)
71 #define QUIT BUTTON_POWER
72 #define ACTION BUTTON_SELECT
73 #define ACTIONTEXT "SELECT"
75 #elif CONFIG_KEYPAD == GIGABEAT_PAD
76 #define QUIT BUTTON_MENU
77 #define ACTION BUTTON_SELECT
78 #define ACTIONTEXT "SELECT"
80 #elif CONFIG_KEYPAD == RECORDER_PAD
81 #define QUIT BUTTON_OFF
82 #define ACTION BUTTON_PLAY
83 #define ACTIONTEXT "PLAY"
85 #elif CONFIG_KEYPAD == ONDIO_PAD
86 #define QUIT BUTTON_OFF
87 #define ACTION BUTTON_UP
88 #define ACTION2 BUTTON_MENU
89 #define ACTIONTEXT "UP"
91 #elif CONFIG_KEYPAD == GIGABEAT_S_PAD
92 #define QUIT BUTTON_BACK
93 #define ACTION BUTTON_SELECT
94 #define ACTION2 BUTTON_MENU
95 #define ACTIONTEXT "SELECT"
97 #elif CONFIG_KEYPAD == MROBE100_PAD
98 #define QUIT BUTTON_POWER
99 #define ACTION BUTTON_SELECT
100 #define ACTIONTEXT "SELECT"
102 #elif CONFIG_KEYPAD == IAUDIO_M3_PAD
103 #define QUIT BUTTON_RC_REC
104 #define ACTION BUTTON_RC_PLAY
105 #define ACTION2 BUTTON_RC_MODE
106 #define ACTIONTEXT "PLAY"
108 #elif CONFIG_KEYPAD == COWOND2_PAD
109 #define QUIT BUTTON_POWER
111 #elif CONFIG_KEYPAD == IAUDIO67_PAD
112 #define QUIT BUTTON_POWER
113 #define ACTION BUTTON_PLAY
114 #define ACTION2 BUTTON_STOP
115 #define ACTIONTEXT "PLAY"
118 #error No keymap defined!
121 #ifdef HAVE_TOUCHSCREEN
123 #define QUIT BUTTON_TOPLEFT
126 #define ACTION BUTTON_BOTTOMLEFT
129 #define ACTION2 BUTTON_BOTTOMRIGHT
132 #define ACTIONTEXT "BOTTOMRIGHT"
136 static const struct plugin_api
* rb
;
138 #define NUMBER_OF_BLOCKS 8
139 #define NUMBER_OF_PARTICLES 3
140 #define MAX_TERRAIN_NODES 15
142 #define LEVEL_MODE_NORMAL 0
143 #define LEVEL_MODE_STEEP 1
146 #define CYCLETIME 100
147 #define SCALE(x) ((x)==1 ? (x) : ((x) >> 1))
155 /*Chopper's local variables to track the terrain position etc*/
156 static int chopCounter
;
157 static int iRotorOffset
;
160 static int iPlayerPosX
;
161 static int iPlayerPosY
;
162 static int iCameraPosX
;
163 static int iPlayerSpeedX
;
164 static int iPlayerSpeedY
;
165 static int iLastBlockPlacedPosX
;
166 static int iGravityTimerCountdown
;
167 static int iPlayerAlive
;
168 static int iLevelMode
;
169 static int blockh
,blockw
;
170 static int highscore
;
173 #define CFG_FILE "chopper.cfg"
174 #define MAX_POINTS 50000
175 static struct configdata config
[] =
177 {TYPE_INT
, 0, MAX_POINTS
, &highscore
, "highscore", NULL
, NULL
}
210 struct CTerrainNode mNodes
[MAX_TERRAIN_NODES
];
212 int iLastNodePlacedPosX
;
215 struct CBlock mBlocks
[NUMBER_OF_BLOCKS
];
216 struct CParticle mParticles
[NUMBER_OF_PARTICLES
];
218 struct CTerrain mGround
;
219 struct CTerrain mRoof
;
221 /*Function declarations*/
222 static void chopDrawParticle(struct CParticle
*mParticle
);
223 static void chopDrawBlock(struct CBlock
*mBlock
);
224 static void chopRenderTerrain(struct CTerrain
*ter
);
225 void chopper_load(bool newgame
);
226 void cleanup_chopper(void);
228 static void chopDrawPlayer(int x
,int y
) /* These are SCREEN coords, not world!*/
232 rb
->lcd_set_foreground(LCD_RGBPACK(50,50,200));
234 rb
->lcd_set_foreground(LCD_DARKGRAY
);
236 rb
->lcd_fillrect(SCALE(x
+6), SCALE(y
+2), SCALE(12), SCALE(9));
237 rb
->lcd_fillrect(SCALE(x
-3), SCALE(y
+6), SCALE(20), SCALE(3));
240 rb
->lcd_set_foreground(LCD_RGBPACK(50,50,50));
242 rb
->lcd_set_foreground(LCD_DARKGRAY
);
244 rb
->lcd_fillrect(SCALE(x
+10), SCALE(y
), SCALE(2), SCALE(3));
245 rb
->lcd_fillrect(SCALE(x
+10), SCALE(y
), SCALE(1), SCALE(3));
248 rb
->lcd_set_foreground(LCD_RGBPACK(40,40,100));
250 rb
->lcd_set_foreground(LCD_BLACK
);
252 rb
->lcd_drawline(SCALE(x
), SCALE(y
+iRotorOffset
), SCALE(x
+20),
253 SCALE(y
-iRotorOffset
));
256 rb
->lcd_set_foreground(LCD_RGBPACK(20,20,50));
258 rb
->lcd_set_foreground(LCD_BLACK
);
260 rb
->lcd_fillrect(SCALE(x
- 2), SCALE(y
+ 5), SCALE(2), SCALE(5));
264 static void chopClearTerrain(struct CTerrain
*ter
)
266 ter
->iNodesCount
= 0;
270 int iR(int low
,int high
)
272 return low
+rb
->rand()%(high
-low
+1);
275 static void chopCopyTerrain(struct CTerrain
*src
, struct CTerrain
*dest
,
276 int xOffset
,int yOffset
)
280 while(i
< src
->iNodesCount
)
282 dest
->mNodes
[i
].x
= src
->mNodes
[i
].x
+ xOffset
;
283 dest
->mNodes
[i
].y
= src
->mNodes
[i
].y
+ yOffset
;
288 dest
->iNodesCount
= src
->iNodesCount
;
289 dest
->iLastNodePlacedPosX
= src
->iLastNodePlacedPosX
;
293 static void chopAddTerrainNode(struct CTerrain
*ter
, int x
, int y
)
297 if(ter
->iNodesCount
+ 1 >= MAX_TERRAIN_NODES
)
299 /* DEBUGF("ERROR: Not enough nodes!\n"); */
305 i
= ter
->iNodesCount
- 1;
307 ter
->mNodes
[i
].x
= x
;
310 ter
->iLastNodePlacedPosX
= x
;
314 static void chopTerrainNodeDeleteAndShift(struct CTerrain
*ter
,int nodeIndex
)
318 while( i
< ter
->iNodesCount
)
320 ter
->mNodes
[i
- 1] = ter
->mNodes
[i
];
329 int chopUpdateTerrainRecycling(struct CTerrain
*ter
)
334 while(i
< ter
->iNodesCount
)
337 if( iCameraPosX
> ter
->mNodes
[i
].x
)
340 chopTerrainNodeDeleteAndShift(ter
,i
);
342 iNewNodePos
= ter
->iLastNodePlacedPosX
+ 50;
348 if(iLevelMode
== LEVEL_MODE_STEEP
)
351 chopAddTerrainNode(ter
,iNewNodePos
,g
- iR(-v
,v
));
363 int chopTerrainHeightAtPoint(struct CTerrain
*ter
, int pX
)
366 int iNodeIndexOne
=0,iNodeIndexTwo
=0, h
, terY1
, terY2
, terX1
, terX2
, a
, b
;
370 for(i
=1;i
<MAX_TERRAIN_NODES
;i
++)
372 if(ter
->mNodes
[i
].x
> pX
)
374 iNodeIndexOne
= i
- 1;
380 iNodeIndexTwo
= iNodeIndexOne
+ 1;
381 terY1
= ter
->mNodes
[iNodeIndexOne
].y
;
382 terY2
= ter
->mNodes
[iNodeIndexTwo
].y
;
385 terX2
= ter
->mNodes
[iNodeIndexTwo
].x
- ter
->mNodes
[iNodeIndexOne
].x
;
387 pX
-= ter
->mNodes
[iNodeIndexOne
].x
;
400 int chopPointInTerrain(struct CTerrain
*ter
, int pX
, int pY
, int iTestType
)
402 int h
= chopTerrainHeightAtPoint(ter
, pX
);
410 static void chopAddBlock(int x
,int y
,int sx
,int sy
, int indexOverride
)
414 if(indexOverride
< 0)
416 while(mBlocks
[i
].bIsActive
&& i
< NUMBER_OF_BLOCKS
)
418 if(i
==NUMBER_OF_BLOCKS
)
420 DEBUGF("No blocks!\n");
427 mBlocks
[i
].bIsActive
= 1;
428 mBlocks
[i
].iWorldX
= x
;
429 mBlocks
[i
].iWorldY
= y
;
430 mBlocks
[i
].iSizeX
= sx
;
431 mBlocks
[i
].iSizeY
= sy
;
433 iLastBlockPlacedPosX
= x
;
436 static void chopAddParticle(int x
,int y
,int sx
,int sy
)
440 while(mParticles
[i
].bIsActive
&& i
< NUMBER_OF_PARTICLES
)
443 if(i
==NUMBER_OF_PARTICLES
)
446 mParticles
[i
].bIsActive
= 1;
447 mParticles
[i
].iWorldX
= x
;
448 mParticles
[i
].iWorldY
= y
;
449 mParticles
[i
].iSpeedX
= sx
;
450 mParticles
[i
].iSpeedY
= sy
;
453 static void chopGenerateBlockIfNeeded(void)
456 int DistSpeedX
= iPlayerSpeedX
* 5;
457 if(DistSpeedX
<200) DistSpeedX
= 200;
459 while(i
< NUMBER_OF_BLOCKS
)
461 if(!mBlocks
[i
].bIsActive
)
465 iX
= iLastBlockPlacedPosX
+ (350-DistSpeedX
);
469 sY
= blockh
+ iR(1,blockh
/3);
471 chopAddBlock(iX
,iY
,sX
,sY
,i
);
479 static int chopBlockCollideWithPlayer(struct CBlock
*mBlock
)
481 int px
= iPlayerPosX
;
482 int py
= iPlayerPosY
;
484 int x
= mBlock
->iWorldX
-17;
485 int y
= mBlock
->iWorldY
-11;
487 int x2
= x
+ mBlock
->iSizeX
+17;
488 int y2
= y
+ mBlock
->iSizeY
+11;
501 static int chopBlockOffscreen(struct CBlock
*mBlock
)
503 if(mBlock
->iWorldX
+ mBlock
->iSizeX
< iCameraPosX
)
509 static int chopParticleOffscreen(struct CParticle
*mParticle
)
511 if (mParticle
->iWorldX
< iCameraPosX
|| mParticle
->iWorldY
< 0 ||
512 mParticle
->iWorldY
> iScreenY
|| mParticle
->iWorldX
> iCameraPosX
+
521 static void chopKillPlayer(void)
525 for (i
= 0; i
< NUMBER_OF_PARTICLES
; i
++) {
526 mParticles
[i
].bIsActive
= 0;
527 chopAddParticle(iPlayerPosX
+ iR(0,20), iPlayerPosY
+ iR(0,20),
533 if (iPlayerAlive
== 0) {
534 rb
->lcd_set_drawmode(DRMODE_FG
);
536 rb
->lcd_set_foreground(LCD_LIGHTGRAY
);
538 rb
->splash(HZ
, "Game Over");
540 if (score
> highscore
) {
543 rb
->snprintf(scoretext
, sizeof(scoretext
), "New High Score: %d",
545 rb
->splash(HZ
*2, scoretext
);
548 rb
->splash(HZ
/4, "Press " ACTIONTEXT
" to continue");
551 rb
->lcd_set_drawmode(DRMODE_SOLID
);
554 button
= rb
->button_get(true);
561 button
= rb
->button_get(true);
562 if (button
== (ACTION
| BUTTON_REL
)
564 || button
== (ACTION2
| BUTTON_REL
)
579 static void chopDrawTheWorld(void)
583 while(i
< NUMBER_OF_BLOCKS
)
585 if(mBlocks
[i
].bIsActive
)
587 if(chopBlockOffscreen(&mBlocks
[i
]) == 1)
588 mBlocks
[i
].bIsActive
= 0;
590 chopDrawBlock(&mBlocks
[i
]);
598 while(i
< NUMBER_OF_PARTICLES
)
600 if(mParticles
[i
].bIsActive
)
602 if(chopParticleOffscreen(&mParticles
[i
]) == 1)
603 mParticles
[i
].bIsActive
= 0;
605 chopDrawParticle(&mParticles
[i
]);
611 chopRenderTerrain(&mGround
);
612 chopRenderTerrain(&mRoof
);
616 static void chopDrawParticle(struct CParticle
*mParticle
)
619 int iPosX
= (mParticle
->iWorldX
- iCameraPosX
);
620 int iPosY
= (mParticle
->iWorldY
);
622 rb
->lcd_set_foreground(LCD_RGBPACK(192,192,192));
624 rb
->lcd_set_foreground(LCD_LIGHTGRAY
);
626 rb
->lcd_fillrect(SCALE(iPosX
), SCALE(iPosY
), SCALE(3), SCALE(3));
630 static void chopDrawScene(void)
635 rb
->lcd_set_background(LCD_BLACK
);
637 rb
->lcd_set_background(LCD_WHITE
);
639 rb
->lcd_clear_display();
642 chopDrawPlayer(iPlayerPosX
- iCameraPosX
, iPlayerPosY
);
644 score
= -20 + iPlayerPosX
/3;
647 rb
->lcd_set_drawmode(DRMODE_COMPLEMENT
);
649 rb
->lcd_set_drawmode(DRMODE_FG
);
653 rb
->lcd_set_foreground(LCD_BLACK
);
655 rb
->lcd_set_foreground(LCD_WHITE
);
659 rb
->snprintf(s
, sizeof(s
), "Dist: %d", score
);
661 rb
->snprintf(s
, sizeof(s
), "Distance: %d", score
);
663 rb
->lcd_getstringsize(s
, &w
, NULL
);
664 rb
->lcd_putsxy(2, 2, s
);
665 if (score
< highscore
)
669 rb
->snprintf(s
, sizeof(s
), "Hi: %d", highscore
);
671 rb
->snprintf(s
, sizeof(s
), "Best: %d", highscore
);
673 rb
->lcd_getstringsize(s
, &w2
, NULL
);
674 if (LCD_WIDTH
- 2 - w2
> w
+ 2)
675 rb
->lcd_putsxy(LCD_WIDTH
- 2 - w2
, 2, s
);
677 rb
->lcd_set_drawmode(DRMODE_SOLID
);
682 static int chopMenu(int menunum
)
684 int result
= (menunum
==0)?0:1;
686 bool menu_quit
= false;
688 static const struct opt_items levels
[2] = {
693 MENUITEM_STRINGLIST(menu
,"Chopper Menu",NULL
,"Start New Game","Resume Game",
696 #ifdef HAVE_LCD_COLOR
697 rb
->lcd_set_foreground(LCD_WHITE
);
698 rb
->lcd_set_background(LCD_BLACK
);
700 rb
->lcd_set_foreground(LCD_BLACK
);
701 rb
->lcd_set_background(LCD_WHITE
);
704 rb
->lcd_clear_display();
707 switch(rb
->do_menu(&menu
, &result
, NULL
, false))
709 case 0: /* Start New Game */
714 case 1: /* Resume Game */
718 } else if(menunum
==0){
719 rb
->splash(HZ
, "No game to resume");
723 rb
->set_option("Level", &iLevelMode
, INT
, levels
, 2, NULL
);
729 case MENU_ATTACHED_USB
:
731 res
= PLUGIN_USB_CONNECTED
;
735 rb
->lcd_clear_display();
739 static int chopGameLoop(void)
741 int move_button
, ret
;
743 int end
, i
=0, bdelay
=0, last_button
=BUTTON_NONE
;
745 if (chopUpdateTerrainRecycling(&mGround
) == 1)
746 /* mirror the sky if we've changed the ground */
747 chopCopyTerrain(&mGround
, &mRoof
, 0, - ( (iScreenY
* 3) / 4));
757 end
= *rb
->current_tick
+ (CYCLETIME
* HZ
) / 1000;
759 if(chopUpdateTerrainRecycling(&mGround
) == 1)
760 /* mirror the sky if we've changed the ground */
761 chopCopyTerrain(&mGround
, &mRoof
, 0, - ( (iScreenY
* 3) / 4));
763 iRotorOffset
= iR(-1,1);
765 /* We need to have this here so particles move when we're dead */
767 for (i
=0; i
< NUMBER_OF_PARTICLES
; i
++)
768 if(mParticles
[i
].bIsActive
== 1)
770 mParticles
[i
].iWorldX
+= mParticles
[i
].iSpeedX
;
771 mParticles
[i
].iWorldY
+= mParticles
[i
].iSpeedY
;
774 /* Redraw the main window: */
778 iGravityTimerCountdown
--;
780 if(iGravityTimerCountdown
<= 0)
782 iGravityTimerCountdown
= 3;
783 chopAddParticle(iPlayerPosX
, iPlayerPosY
+5, 0, 0);
786 if(iLevelMode
== LEVEL_MODE_NORMAL
)
787 chopGenerateBlockIfNeeded();
790 move_button
=rb
->button_status();
791 if (rb
->button_get(false) == QUIT
) {
796 last_button
= BUTTON_NONE
;
797 move_button
= BUTTON_NONE
;
800 switch (move_button
) {
805 if (last_button
!= ACTION
807 && last_button
!= ACTION2
816 if (last_button
== ACTION
818 || last_button
== ACTION2
825 if (rb
->default_event_handler(move_button
) == SYS_USB_CONNECTED
)
826 return PLUGIN_USB_CONNECTED
;
829 last_button
= move_button
;
832 iPlayerSpeedY
= bdelay
;
834 } else if (bdelay
> 0) {
835 iPlayerSpeedY
= bdelay
;
839 iCameraPosX
= iPlayerPosX
- 25;
840 iPlayerPosX
+= iPlayerSpeedX
;
841 iPlayerPosY
+= iPlayerSpeedY
;
844 /* increase speed as we go along */
845 if (chopCounter
== 100){
850 if (iPlayerPosY
> iScreenY
-10 || iPlayerPosY
< -5 ||
851 chopPointInTerrain(&mGround
, iPlayerPosX
, iPlayerPosY
+ 10, 0) ||
852 chopPointInTerrain(&mRoof
, iPlayerPosX
,iPlayerPosY
, 1))
861 for (i
=0; i
< NUMBER_OF_BLOCKS
; i
++)
862 if(mBlocks
[i
].bIsActive
== 1)
863 if(chopBlockCollideWithPlayer(&mBlocks
[i
])) {
871 if (end
> *rb
->current_tick
)
872 rb
->sleep(end
-*rb
->current_tick
);
880 static void chopDrawBlock(struct CBlock
*mBlock
)
882 int iPosX
= (mBlock
->iWorldX
- iCameraPosX
);
883 int iPosY
= (mBlock
->iWorldY
);
885 rb
->lcd_set_foreground(LCD_RGBPACK(100,255,100));
887 rb
->lcd_set_foreground(LCD_BLACK
);
889 rb
->lcd_fillrect(SCALE(iPosX
), SCALE(iPosY
), SCALE(mBlock
->iSizeX
),
890 SCALE(mBlock
->iSizeY
));
894 static void chopRenderTerrain(struct CTerrain
*ter
)
902 if(ter
->mNodes
[0].y
< (LCD_HEIGHT
*SIZE
)/2)
905 ay
=(LCD_HEIGHT
*SIZE
);
907 while(i
< ter
->iNodesCount
&& oldx
< iScreenX
)
910 int x
= ter
->mNodes
[i
-1].x
- iCameraPosX
;
911 int y
= ter
->mNodes
[i
-1].y
;
913 int x2
= ter
->mNodes
[i
].x
- iCameraPosX
;
914 int y2
= ter
->mNodes
[i
].y
;
916 rb
->lcd_set_foreground(LCD_RGBPACK(100,255,100));
918 rb
->lcd_set_foreground(LCD_DARKGRAY
);
921 rb
->lcd_drawline(SCALE(x
), SCALE(y
), SCALE(x2
), SCALE(y2
));
923 xlcd_filltriangle(SCALE(x
), SCALE(y
), SCALE(x2
), SCALE(y2
),
924 SCALE(x2
), SCALE(ay
));
925 xlcd_filltriangle(SCALE(x
), SCALE(ay
), SCALE(x2
), SCALE(y2
),
926 SCALE(x2
), SCALE(ay
));
929 xlcd_filltriangle(SCALE(x
), SCALE(ay
), SCALE(x
), SCALE(y
),
930 SCALE(x2
), SCALE(y2
/ 2));
932 xlcd_filltriangle(SCALE(x
), SCALE(ay
), SCALE(x
), SCALE(y
),
933 SCALE(x2
), SCALE((LCD_HEIGHT
*SIZE
) -
934 ((LCD_HEIGHT
*SIZE
) - y2
) / 2));
943 void chopper_load(bool newgame
)
950 iScreenX
= LCD_WIDTH
* SIZE
;
951 iScreenY
= LCD_HEIGHT
* SIZE
;
952 blockh
= iScreenY
/ 5;
953 blockw
= iScreenX
/ 20;
959 iPlayerPosY
= (iScreenY
* 4) / 10;
960 iLastBlockPlacedPosX
= 0;
961 iGravityTimerCountdown
= 2;
967 for (i
=0; i
< NUMBER_OF_PARTICLES
; i
++)
968 mParticles
[i
].bIsActive
= 0;
970 for (i
=0; i
< NUMBER_OF_BLOCKS
; i
++)
971 mBlocks
[i
].bIsActive
= 0;
974 chopClearTerrain(&mGround
);
976 for (i
=0; i
< MAX_TERRAIN_NODES
; i
++)
977 chopAddTerrainNode(&mGround
,i
* 30,g
- iR(0,20));
979 if (chopUpdateTerrainRecycling(&mGround
) == 1)
980 /* mirror the sky if we've changed the ground */
981 chopCopyTerrain(&mGround
, &mRoof
, 0, - ( (iScreenY
* 3) / 4));
983 iLevelMode
= LEVEL_MODE_NORMAL
;
984 if (iLevelMode
== LEVEL_MODE_NORMAL
)
985 /* make it a bit more exciting, cause it's easy terrain... */
989 /* this is the plugin entry point */
990 enum plugin_status
plugin_start(const struct plugin_api
* api
, const void* parameter
)
996 rb
->lcd_setfont(FONT_SYSFIXED
);
998 rb
->lcd_set_backdrop(NULL
);
1000 #ifdef HAVE_LCD_COLOR
1001 rb
->lcd_set_background(LCD_BLACK
);
1002 rb
->lcd_set_foreground(LCD_WHITE
);
1005 /* Turn off backlight timeout */
1006 backlight_force_on(rb
); /* backlight control in lib/helper.c */
1008 rb
->srand( *rb
->current_tick
);
1011 configfile_init(rb
);
1012 configfile_load(CFG_FILE
, config
, 1, 0);
1015 ret
= chopGameLoop();
1017 configfile_save(CFG_FILE
, config
, 1, 0);
1019 rb
->lcd_setfont(FONT_UI
);
1020 /* Turn on backlight timeout (revert to settings) */
1021 backlight_use_settings(rb
); /* backlight control in lib/helper.c */