natto Le 18/04/2002 à 12:18
test:
// C Source File
// Created 25/12/2001; 18:42:29
// C Source File
// Created 20/12/2001; 17:07:06
#include "doors.h" // Make Kernel Program
#include <tigcclib.h> // Include All Header Files
#include <genc.h>
#define ti89 //mettre ti89 pour compiler pour ti89 ;p
#ifdef ti89
#define scroll_max_x 98
#define scroll_max_y 38
#define max_map_x 240+16*5
#define max_map_y 128+32
short _ti89; // Produce .89Z File
#else
#define scroll_max_x 188
#define scroll_max_y 66
#define max_map_x 160+16*5
#define max_map_y 96+32
short _ti92plus; // Produce .9XZ File
#endif
extern BGS hawk_right0[]; extern BGS hawk_right1[];
extern BGS hawk_right2[]; extern BGS hawk_right3[];
extern BGS hawk_right4[]; extern BGS hawk_right5[];
extern BGS hawk_right6[]; extern BGS hawk_left0[];
extern BGS hawk_left1[]; extern BGS hawk_left2[];
extern BGS hawk_left3[]; extern BGS hawk_left4[];
extern BGS hawk_left5[]; extern BGS hawk_left6[];
extern BGS hawk_up0[]; extern BGS hawk_up1[];
extern BGS hawk_up2[]; extern BGS hawk_up3[];
extern BGS hawk_up4[]; extern BGS hawk_up5[];
extern BGS hawk_up6[]; extern BGS hawk_down0[];
extern BGS hawk_down1[]; extern BGS hawk_down2[];
extern BGS hawk_down3[]; extern BGS hawk_down4[];
extern BGS hawk_down5[]; extern BGS hawk_down6[];
extern BGS hawk_eagerleft1[]; extern BGS hawk_eagerright1[];
extern BGS hawk_eagerleft2[]; extern BGS hawk_eagerright2[];
BGS *hawk[] = {hawk_up0,hawk_up1,hawk_up2,hawk_up3,hawk_up4,hawk_up5,hawk_up6,hawk_down0,hawk_down1,hawk_down2,hawk_down3,hawk_down4,hawk_down5,hawk_down6,hawk_left0,hawk_left1,hawk_left2,hawk_left3,hawk_left4,hawk_left5,hawk_left6,hawk_right0,hawk_right1,hawk_right2,hawk_right3,hawk_right4,hawk_right5,hawk_right6,hawk_eagerleft1,hawk_eagerleft2,hawk_eagerright1,hawk_eagerright2};
JOYPAD j;
PLANE *P;
DSCREEN *DScr[2] = {NULL, NULL };
int ts = 0;
short x_hero=45,y_hero=45,dir=0,action=0,move=0,time=0,leaderm=0,ani1=0,size_x=32,size_y=32;
short anime_perso(BGS **perso,short x,short y,short img,short anim,short ani)
{
gl_put_big_sprite(x,y,*(perso+img+ani));
time++;
if(time>=21){time=0; ani++; if(ani>=anim)ani=0; }
return ani;
}
//deplacements du leader
void move_leader(void)
{
move=0;
j = gl_read_joypad();
if (!j.up_key ){dir=0; if(y_hero>30 || P->ys==0) y_hero-=2; else P->ys-=2; time++;if(time>=7){action++;time=0;} if (action==7) action=1; move=1;}
if (!j.down_key ){dir=7; if(y_hero<scroll_max_y || P->ys==size_y*16-(max_map_y))y_hero+=2; else P->ys+=2; if(move==0 ){time++;if(time>=7){action++;time=0;}} if (action==7) action=1; move=1;}
if (!j.left_key ){dir=14; if(x_hero>30 || P->xs==0) x_hero-=2; else P->xs-=2; if(move==0 ){time++;if(time>=7){action++;time=0;}} if (action==7) action=1; move=1;}
if (!j.right_key){dir=21; if(x_hero<scroll_max_x || P->xs==size_x*16-(max_map_x))x_hero+=2; else P->xs+=2; if(move==0 ){time++;if(time>=7){action++;time=0;}} if (action==7) action=1; move=1;}
if(move==0) {action=0;leaderm++;}
else leaderm=0;
if (leaderm>100) {
if (dir==14 || dir==7)ani1=anime_perso(hawk,x_hero,y_hero,28,2,ani1);
else ani1=anime_perso(hawk,x_hero,y_hero,30,2,ani1);
}
else gl_put_big_sprite(x_hero,y_hero,hawk[dir+action]);
}
// Double-buffer function
void SwapBuffer()
{
gl_set_dscreen_int(DScr[ts]);
ts ^= 1;
gl_set_dscreen_function(DScr[ts]);
}
// Constant speed 30Hz function
void Wait30()
{
gl_timer = 0;
while (gl_frame_timer < 1);
gl_frame_timer = 0;
}
// Constant speed 15Hz function
void Wait15()
{
gl_timer = 0;
while (gl_frame_timer < 2);
gl_frame_timer = 0;
}
// Ready to print ?
void Ready()
{
while (gl_timer == 0);
}
void lets_start();
void _main()
{
HANDLE hd;
gl_init(); // Init genlib
gl_init_dscreen(&DScr[0], &hd); // Alloc 1 DScreen
if (hd == H_NULL) goto exit; // Quit if error
gl_push_hd(hd); // Save the handle
gl_init_dscreen(&DScr[1], &hd); // Alloc the 2nd DScreen
if (hd == 0) goto exit; // Quit if error
gl_push_hd(hd); // Save the handle
gl_set_dscreen_int(DScr[0]); // Define the printed DScreen
gl_set_dscreen_function(DScr[0]); // Define the working DScreen
gl_cls(); // Clear the working DScreen
lets_start(); // Main program
exit:
//PortRestore(); // If we have called PortSet
gl_free_hd(); // Free all the allocated handles
gl_quit(); // Quit Genlib
}
void lets_start(void)
{
char map[] = { // A matrix of 32x32
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,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,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2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,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
};
char tiles[] = { // blanc, noir , herbe , plancher
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x44,0x10,
0x3B,0xCC,0x02,0x20,0x7D,0xDD,0x90,0x08,0x63,0xF5,
0x01,0x82,0xF8,0x7D,0x64,0xB0,0x99,0x4F,0xC2,0x37,
0x3D,0xC8,0x30,0xC1,0xC3,0x3E,0x8C,0xCC,0x71,0x33,
0x43,0x16,0x3C,0xC9,0x05,0x20,0xE2,0x9F,0x90,0x21,
0x4F,0x9E,0xA4,0x4C,0x58,0xB3,0xC1,0x1D,0x3E,0x62,
0x0C,0x83,0xF3,0x7C,0xB6,0x31,0x49,0xCE,0x18,0x20,
0xE7,0xDF,0xFF,0xFF,0xFF,0xFF,0xFE,0x3F,0x09,0xC0,
0xEC,0x13,0x0B,0xEC,0x0F,0xFD,0x08,0x00,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFB,0x00,0x08,0xFF,0xE9,0x00,0x08,
0x00,0x38,0x00,0x08,0xFF,0xFF,0xFF,0xFF,0x0E,0x3F,
0x09,0xC0,0x0C,0x13,0x0B,0xEC,0x0F,0xFD,0x08,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0x00,0x08,0xFF,0xE9,
0x00,0x08,0x00,0x38,0x00,0x08};
gl_change_update(); // Real size.
P=gl_init_plane(map, tiles, 32);
P->xs = 10;
P->ys = 10;
j = gl_read_joypad();
while (j.exit_key) {
gl_update_vscreen_16(P);
Ready();
gl_put_plane(P);
move_leader();
SwapBuffer();
Wait30();
}
gl_free_plane(P);
}

納 豆パワー!
I becamed a natto!!!1!one!