#include "fxlib.h"
#include "stdio.h"
unsigned int key;
int caractere, caractere2;
char chaine[21];
char ident[21];
char domaine[30];
char mdp[30];
char destinataire[40];
char sujet[30];
char corps[50];
int AddIn_main(int isAppli, unsigned short OptionNum){
Bdisp_AllClr_DDVRAM();
demmarage();
identif();
return 1;
}
demmarage(){
int key;
Bdisp_AllClr_DDVRAM();
PrintMini(80,58,"Version 1.0",0);
Bdisp_DrawLineVRAM(10,10,10,50);
Bdisp_DrawLineVRAM(10,50,117,50);
Bdisp_DrawLineVRAM(117,50,117,10);
Bdisp_DrawLineVRAM(10,10,117,10);
Bdisp_DrawLineVRAM(10,10,63,25);
Bdisp_DrawLineVRAM(117,10,63,25);
locate(7,5);
Print("Messagerie");
do{
GetKey(&key);
} while(key != 30004);
Bdisp_AllClr_DDVRAM();
}
identif(){
Bdisp_AllClr_DDVRAM();
locate(1,1);
Print("Identifiant:");
locate(1,2);
Print("+------------------+");
locate(1,3);
Print("| |");
locate(1,4);
Print("+------------------+");
remplichaine();
caractere2=0;
do{
caractere2++;
ident[caractere2] = chaine[caractere2];
} while(caractere2+1 != caractere);
========================== > ICI < ========
locate(2,3);
Print(ident);
do{
GetKey(&key);
} while(key != 30004);
}
remplichaine(){
caractere=0;
do{
caractere++;
======================= > ET ICI < ========
locate(2,3);
Print(chaine);
GetKey(&key);
//==========Conversion==========
if (key==48)key= 71;
if (key==46)key= 61;
if (key==15)key= 51;
if (key==135)key= 41;
if (key==30004)key= 31;
if (key==49)key= 72;
if (key==50)key= 62;
if (key==51)key= 52;
if (key==137)key= 42;
if (key==153)key= 32;
if (key==52)key= 73;
if (key==53)key= 63;
if (key==54)key= 53;
if (key==169)key= 43;
if (key==185)key= 33;
if (key==55)key= 74;
if (key==56)key= 64;
if (key==57)key= 54;
if (key==30025)key= 44;
if (key==30015)key= 34;
if (key==187)key= 75;
if (key==30046)key= 65;
if (key==40)key= 55;
if (key==41)key= 45;
if (key==44)key= 35;
if (key==14)key= 25;
if (key==30001)key= 76;
if (key==149)key= 66;
if (key==133)key= 56;
if (key==129)key= 46;
if (key==130)key= 36;
if (key==131)key= 26;
if (key==30007)key= 77;
if (key==205)key= 67;
if (key==168)key= 57;
if (key==30002)key= 47;
if (key==30023)key= 37;
if (key==30021)key= 27;
if (key==30006)key= 78;
if (key==30008)key= 68;
if (key==30016)key= 58;
if (key==30020)key= 38;
if (key==30018)key= 28;
if (key==30009)key= 79;
if (key==30010)key= 69;
if (key==30011)key= 59;
if (key==30012)key= 49;
if (key==30013)key= 39;
if (key==30014)key= 29;
//==============================
if(key==31)caractere=19;
if(key==76)chaine[caractere]='a';
if(key==66)chaine[caractere]='b';
if(key==56)chaine[caractere]='c';
if(key==46)chaine[caractere]='d';
if(key==36)chaine[caractere]='e';
if(key==26)chaine[caractere]='f';
if(key==75)chaine[caractere]='g';
if(key==65)chaine[caractere]='h';
if(key==55)chaine[caractere]='i';
if(key==45)chaine[caractere]='j';
if(key==35)chaine[caractere]='k';
if(key==25)chaine[caractere]='l';
if(key==74)chaine[caractere]='m';
if(key==64)chaine[caractere]='n';
if(key==54)chaine[caractere]='o';
if(key==73)chaine[caractere]='p';
if(key==63)chaine[caractere]='q';
if(key==53)chaine[caractere]='r';
if(key==43)chaine[caractere]='s';
if(key==33)chaine[caractere]='t';
if(key==72)chaine[caractere]='u';
if(key==62)chaine[caractere]='v';
if(key==52)chaine[caractere]='w';
if(key==42)chaine[caractere]='x';
if(key==32)chaine[caractere]='y';
if(key==71)chaine[caractere]='z';
if(key==61)chaine[caractere]='.';
if(key==57)chaine[caractere]='@';
} while(caractere!=19);
if(key==31)chaine[caractere]='\0';
if(key!=31)chaine[caractere+1]='\0';
}
#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum){return INIT_ADDIN_APPLICATION(isAppli, OptionNum);}
#pragma section
Citer : Posté le 24/04/2014 16:53 | #
oui mais admetont que mes scores sont enregistrés dans le fichier sous la forme
"123+234+123+432+001"
Faut que ca me lise le fichier seulement score par score vu que apres je stocke dans un tableau (scores[])
Citer : Posté le 24/04/2014 16:55 | #
Pas de souci.
#define SCORES 5
void getScores()
{
char *ch = calloc(4,1);
int i, scores[SCORES];
for(i=0;i<SCORES;i++)
{
Bfile_ReadFile(handle,ch,3,-1);
scores[i] = atoi(ch);
}
}
Citer : Posté le 26/04/2014 18:17 | #
Merci c'est presque ca qu'il me faut
Au fait:
Citer : Posté le 26/04/2014 18:19 | #
Oui, au début j'ai mis
ce qui signifie qu'au tout début de la compilation, partout où il verra SCORES dans le programme, il remplacera par 5. Ça permet d'utiliser des constantes sans prendre de place dans la mémoire.
Et du coup, si tu mets SCORES partout où tu veux mettre le nombre de scores à enregistrer, il te suffit de modifier ton define pour que tout le programme soit adapté.
Citer : Posté le 26/04/2014 18:31 | #
Par contre ça me renvoi pas ce qu'il me faut
{
unsigned int key;
int i;
int handle;
char buffer[50];
char *ch = calloc(4,1);
FONTCHARACTER filename[]={'\\','\\','f','l','s','0','\\','s','n','i','p','r','.','s','c','r',0};
handle = Bfile_OpenFile(filename,_OPENMODE_READ);
// SI FICHIER OUVERT
if(handle!=-1){
for(i=0;i<5;i++)
{
Bfile_ReadFile(handle,ch,3,4*i);
scores[i] = atoi(ch);
}
}
// SINON CREATION
else{
//*vitesse = 5;
SaveDisp(1);
Bdisp_AllClr_DDVRAM();
Bfile_CreateFile(filename, 8);
handle = Bfile_OpenFile(filename,_OPENMODE_READWRITE);
// sprintf(buffer,"000-000-000-000-000");
sprintf(buffer,"999-326-249-125-095");
Bfile_WriteFile(handle,buffer,15);
locate(1,1);
Print("Un fichier a ete cree");
locate(6,2);
Print("snipr.scr");
locate(1,3);
Print(" Merci de ne pas le");
locate(1,4);
Print("supprimer.");
locate(5,6);
Print("Press [ExE]");
do{
GetKey(&key);
}while(key!=30004);
lect_scores(scores);
RestoreDisp(1);
}
Bfile_CloseFile(handle);
}
Et il me renvoi:
scores[0]=999
scores[1]=326
scores[2]=326
scores[3]=326
scores[4]=326
Citer : Posté le 26/04/2014 18:35 | #
Je le savais, je voulais juste faire du suspense.
En fait tu lis les caractères trois par trois, mais il y a les séparateurs.
Vire-les à l'écriture et tu seras tranquille.
Citer : Posté le 26/04/2014 18:38 | #
En changeant par
Le resultat est:
scores[0]=999
scores[1]=326
scores[2]=246
scores[3]=246
scores[4]=246
Citer : Posté le 26/04/2014 18:45 | #
Pourquoi 3*i ?
Lorsque tu lis un fichier de façon linéaire, mets toujours -1. Ça équivaut à la position actuelle du curseur, qui est mise à jour à chaque lecture. C'est plus simple si le fichier est composé du plusieurs parties et c'est plus rapide.
Citer : Posté le 26/04/2014 18:47 | #
Changé, toujours le même problème ...
Citer : Posté le 26/04/2014 18:51 | #
Je peux avoir le code complet ?
Citer : Posté le 26/04/2014 18:53 | #
Le code:
/* CASIO fx-9860G SDK Library */
/* File name : SNIPER.c */
/* By: TheProg */
/* Version: 0.01 */
/* Credits: Pierrotll for Ml lib */
/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */
/*****************************************************************/
#include "fxlib.h"
#include "MonochromeLib.h"
#include "SNIPER.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// FAIT
int AddIn_main(int isAppli, unsigned short OptionNum)
{
unsigned int key, choix;
Bdisp_AllClr_DDVRAM();
do{
choix = 0;
choix = menu();
}while(choix != -1);
quitter();
return 1;
}
// FAIT
int menu()
{
// SPRITES
const unsigned char menu[]={
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0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xff,0xff,
0x0,0x1b,0xec,0x0,0x7f,0xf7,0x77,0xfe,0x0,0xd,0x80,0x1f,0xff,0xff,0xff,0xff,
0x0,0x1b,0xec,0x0,0x7f,0xec,0x1b,0xff,0x80,0xd,0x80,0x3f,0xff,0xff,0xff,0xff,
0x0,0x19,0xcc,0x0,0x7f,0xff,0x7f,0xff,0xe0,0xd,0x80,0x7f,0xff,0xff,0xff,0xff,
0x0,0x1f,0xfc,0x0,0xff,0xfe,0x3f,0xff,0xfc,0xd,0x83,0xff,0xff,0xff,0xff,0xff,
0x0,0xf,0xf8,0x0,0xff,0xfd,0xdf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1,0xc0,0x1,0xff,0xfd,0xdf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1,0xc0,0x3,0xff,0xfd,0xdf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1,0xc0,0x3,0xff,0xfd,0xdf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x61,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
};
const unsigned char viseur[]={
0xff,0xf8,0x1f,0xff,
0xff,0x80,0x1,0xff,
0xfe,0x0,0x0,0x7f,
0xfc,0x0,0x0,0x3f,
0xf8,0x0,0x0,0x1f,
0xf0,0x0,0x0,0xf,
0xe0,0x0,0x0,0x7,
0xc0,0x0,0x0,0x3,
0xc0,0x0,0x0,0x3,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x1,0x80,0x0,
0x0,0x1,0x80,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0xc0,0x0,0x0,0x3,
0xc0,0x0,0x0,0x3,
0xe0,0x0,0x0,0x7,
0xf0,0x0,0x0,0xf,
0xf8,0x0,0x0,0x1f,
0xfc,0x0,0x0,0x3f,
0xfe,0x0,0x0,0x7f,
0xff,0x80,0x1,0xff,
0xff,0xf8,0x1f,0xff
};
// VARIABLES
int x_viseur, y_viseur;
int vitesse;
reglages(&vitesse);
Bdisp_AllClr_DDVRAM();
x_viseur = 64;
y_viseur = 32;
do{
ML_rectangle(0,0,128,64,0, ML_BLACK, ML_BLACK);
ML_bmp_and_cl(viseur, x_viseur-16, y_viseur-16, 32, 32);
ML_bmp_or(menu, 0, 0, 128, 64);
ML_display_vram();
if(IsKeyDown(30023) && y_viseur+1 != 64) y_viseur++;
if(IsKeyDown(30018) && y_viseur-1 != 0) y_viseur--;
if(IsKeyDown(30021) && x_viseur+1 != 128) x_viseur++;
if(IsKeyDown(30020) && x_viseur-1 != 0) x_viseur--;
if(IsKeyDown(SHOOT)){
if(x_viseur>=1 && x_viseur<=31 && y_viseur>=37 && y_viseur<=45) return -1; // QUITTER
if(x_viseur>=36 && x_viseur<=59 && y_viseur>=9 && y_viseur<=17) menu_jeu(); // JOUER
if(x_viseur>=63 && x_viseur<=92 && y_viseur>=27 && y_viseur<=35) options(); // OPTIONS
if(x_viseur>=99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e,0x0,0x0,0x3f,0xe0,0x0,0x7f,0xff,0xff,0xf8,
0xf,0xff,0xff,0xf8,0x0,0x7f,0xff,0x80,0x0,0x7,0x0,0x0,0xff,0xff,0xff,0xfe,
0x0,0x18,0xc,0x0,0x1,0xff,0xff,0xc0,0x0,0x7,0x0,0x1,0xff,0xff,0xff,0xff,
0x0,0x1b,0xec,0x0,0x3,0xff,0xff,0xe0,0x0,0x7,0x0,0x3,0xff,0xff,0xff,0xff,
0x0,0x1b,0xec,0x0,0x7,0xff,0xff,0xf0,0x0,0xd,0x80,0x7,0xff,0xff,0xff,0xff,
0x0,0x1a,0xac,0x0,0xf,0xff,0xff,0xf8,0x0,0xd,0x80,0xf,0xff,0xff,0xff,0xff,
0x0,0x1b,0xec,0x0,0x1f,0xff,0xff,0xfe,0x0,0xd,0x80,0x1f,0xff,0xff,0xff,0xff,
0x0,0x1b,0xec,0x0,0x3f,0xff,0xff,0xff,0x80,0xd,0x80,0x3f,0xff,0xff,0xff,0xff,
0x0,0x19,0xcc,0x0,0x7f,0xff,0xff,0xff,0xe0,0xd,0x80,0x7f,0xff,0xff,0xff,0xff,
0x0,0x1f,0xfc,0x0,0xff,0xff,0xff,0xff,0xfc,0xd,0x83,0xff,0xff,0xff,0xff,0xff,
0x0,0xf,0xf8,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1,0xc0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1,0xc0,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1,0xc0,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x33,
0x0,0x3,0x60,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,
0x0,0x3,0x60,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x33,
0x0,0x3,0x61,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
};
const unsigned char viseur[]={
0xff,0xf8,0x1f,0xff,
0xff,0x80,0x1,0xff,
0xfe,0x0,0x0,0x7f,
0xfc,0x0,0x0,0x3f,
0xf8,0x0,0x0,0x1f,
0xf0,0x0,0x0,0xf,
0xe0,0x0,0x0,0x7,
0xc0,0x0,0x0,0x3,
0xc0,0x0,0x0,0x3,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x1,0x80,0x0,
0x0,0x1,0x80,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0xc0,0x0,0x0,0x3,
0xc0,0x0,0x0,0x3,
0xe0,0x0,0x0,0x7,
0xf0,0x0,0x0,0xf,
0xf8,0x0,0x0,0x1f,
0xfc,0x0,0x0,0x3f,
0xfe,0x0,0x0,0x7f,
0xff,0x80,0x1,0xff,
0xff,0xf8,0x1f,0xff
};
// VARIABLES
int x_viseur, y_viseur;
int vitesse;
int retour;
reglages(&vitesse);
Bdisp_AllClr_DDVRAM();
x_viseur = 64;
y_viseur = 32;
retour = 0;
do{
// AFFICHAGE
ML_rectangle(0,0,128,64,0, ML_BLACK, ML_BLACK);
ML_bmp_and_cl(viseur, x_viseur-16, y_viseur-16, 32, 32);
ML_bmp_or(menu, 0, 0, 128, 64);
ML_display_vram();
// GESTION DES TOUCHES
if(IsKeyDown(30023) && y_viseur+1 != 64) y_viseur++;
if(IsKeyDown(30018) && y_viseur-1 != 0) y_viseur--;
if(IsKeyDown(30021) && x_viseur+1 != 128) x_viseur++;
if(IsKeyDown(30020) && x_viseur-1 != 0) x_viseur--;
if(IsKeyDown(30002)) retour = 1;
if(IsKeyDown(SHOOT)){
if(x_viseur>=3 && x_viseur<=29 && y_viseur>=37 && y_viseur<=45) retour=1; // RETOUR
if(x_viseur>=39 && x_viseur<=56 && y_viseur>=17 && y_viseur<=25) jeu_solo(); // SOLO
// if(x_viseur>=67 && x_viseur<=88 && y_viseur>=27 && y_viseur<=35) multi(); // MULTI
// if(x_viseur>=91 && x_viseur<=126 && y_viseur>=12 && y_viseur<=20) aventure();// AVENTURE
while(IsKeyDown(SHOOT));
}
Sleep(2*vitesse);
}while(!retour);
}
// FAIT
void options()
{
unsigned int key;
// SPRITES
const unsigned char menu[]={
0x0,0x0,0x0,0x0,0x0,0x0,0x1f,0xff,0xff,0xff,0xff,0xe0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x26,0x0,0x4,0x0,0x0,0x10,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x28,0x4a,0x31,0x14,0xb9,0x10,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x24,0xad,0x45,0xd4,0x92,0x90,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x22,0x89,0x15,0x54,0x92,0x10,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x2c,0x69,0x65,0xd6,0x91,0x90,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x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0,0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xd8,0x0,
0x16,0x0,0x0,0x4,0x0,0x0,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x15,0x27,0x75,0x74,0x0,0x0,0x7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x16,0x52,0x55,0x54,0x0,0x0,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x15,0x42,0x55,0x44,0x0,0x0,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x15,0x32,0x77,0x44,0x0,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x10,0x0,0x0,0x4,0x0,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xf,0xff,0xff,0xf8,0x0,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x18,0xc,0x0,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1b,0xec,0x0,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1b,0xec,0x0,0x0,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1a,0xac,0x0,0x0,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1b,0xec,0x0,0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1b,0xec,0x0,0x0,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x19,0xcc,0x0,0x0,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1f,0xfc,0x0,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0xf,0xf8,0x0,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1,0xc0,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1,0xc0,0x0,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x1,0xc0,0x0,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x0,0x7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x0,0x3,0x60,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
};
const unsigned char viseur[]={
0xff,0xf8,0x1f,0xff,
0xff,0x80,0x1,0xff,
0xfe,0x0,0x0,0x7f,
0xfc,0x0,0x0,0x3f,
0xf8,0x0,0x0,0x1f,
0xf0,0x0,0x0,0xf,
0xe0,0x0,0x0,0x7,
0xc0,0x0,0x0,0x3,
0xc0,0x0,0x0,0x3,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x1,0x80,0x0,
0x0,0x1,0x80,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0xc0,0x0,0x0,0x3,
0xc0,0x0,0x0,0x3,
0xe0,0x0,0x0,0x7,
0xf0,0x0,0x0,0xf,
0xf8,0x0,0x0,0x1f,
0xfc,0x0,0x0,0x3f,
0xfe,0x0,0x0,0x7f,
0xff,0x80,0x1,0xff,
0xff,0xf8,0x1f,0xff
};
unsigned int buffet[1100];
// VAR POUR FICHIER
int x_viseur, y_viseur;
int vitesse;
int retour;
int handle;
char buffer[7];
FONTCHARACTER filename[]={'\\','\\','f','l','s','0','\\','s','n','i','p','r','.','r','g','l',0};
Bdisp_AllClr_DDVRAM();
x_viseur = 64;
y_viseur = 32;
retour = 0;
reglages(&vitesse);
do{
// AFFICHAGE
ML_clear_vram();
sprintf(buffer,"%d",vitesse);
PrintMini(68,8,buffer,0);
memcpy(buffet, ML_vram_adress(), 1024);
ML_rectangle(0,0,128,64,0, ML_BLACK, ML_BLACK);
ML_bmp_and_cl(viseur, x_viseur-16, y_viseur-16, 32, 32);
ML_bmp_or(buffet, 0, 0, 128, 64);
ML_bmp_or(menu, 0, 0, 128, 64);
ML_display_vram();
// GESTION TOUCHES
if(IsKeyDown(30023) && y_viseur+1 != 64) y_viseur++;
if(IsKeyDown(30018) && y_viseur-1 != 0) y_viseur--;
if(IsKeyDown(30021) && x_viseur+1 != 128) x_viseur++;
if(IsKeyDown(30020) && x_viseur-1 != 0) x_viseur--;
if(IsKeyDown(30002)) retour = 1;
if(IsKeyDown(SHOOT)){
if(x_viseur>=3 && x_viseur<=29 && y_viseur>=37 && y_viseur<=45) retour = 1; // RETOUR
if(x_viseur>=99 && x_viseur<=127 && y_viseur>=12 && y_viseur<=20) credits(); // RETOUR
if(x_viseur>=52 && x_viseur<=59 && y_viseur>=7 && y_viseur<=14 && vitesse!=0) vitesse--; // DIMI VITESSE
if(x_viseur>=81 && x_viseur<=88 && y_viseur>=7 && y_viseur<=14 && vitesse!=9) vitesse++; // AUGM VITESSE
while(IsKeyDown(SHOOT)); // TEMPO
}
Sleep(2*vitesse);
}while(!retour);
// ECRITURE REGLAGES
sprintf(buffer,"%d",9-vitesse);
Bfile_CloseFile(handle);
Bfile_DeleteFile(filename);
Bfile_CreateFile(filename, 8);
handle = Bfile_OpenFile(filename,_OPENMODE_READWRITE);
Bfile_WriteFile(handle,buffer,7);
// FERMETURE DU FICHIER
Bfile_CloseFile(handle);
}
// A FAIRE
void score()
{
// SPRITES
const unsigned char scores[]={
0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0xc0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x1,0x80,0x7,0x0,0x0,0x0,0x1,0x80,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0xc0,0x8,0x32,0x72,0x30,0x3,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x62,0x6,0x45,0x55,0x40,0x46,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x77,0x1,0x45,0x44,0x10,0xee,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x3b,0x8e,0x32,0x43,0x61,0xdc,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x1f,0xc0,0x0,0x0,0x3,0xf8,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0xe,0x80,0x0,0x0,0x1,0x70,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x7,0xf,0xff,0xff,0xf0,0xe0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x3,0x80,0x0,0x0,0x1,0xc0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x3,0xc0,0x0,0x0,0x3,0xc0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0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vitesse, nbr;
int retour;
int tab_scores[5];
char buffer[5];
reglages(&vitesse);
lect_scores(tab_scores);
Bdisp_AllClr_DDVRAM();
x_viseur = 64;
y_viseur = 32;
retour = 0;
do{
// AFFICHAGE
ML_clear_vram();
for(nbr=0;nbr<5;nbr++){
sprintf(buffer,"%d",tab_scores[nbr]);
PrintMini(41,31+6*nbr,buffer,0);
}
memcpy(buffet, ML_vram_adress(), 1024);
ML_rectangle(0,0,128,64,0, ML_BLACK, ML_BLACK);
ML_bmp_and_cl(viseur, x_viseur-16, y_viseur-16, 32, 32);
ML_bmp_or(buffet, 0, 0, 128, 64);
ML_bmp_or(scores, 0, 0, 128, 64);
ML_display_vram();
// GESTION DES TOUCHES
if(IsKeyDown(30023) && y_viseur+1 != 64) y_viseur++;
if(IsKeyDown(30018) && y_viseur-1 != 0) y_viseur--;
if(IsKeyDown(30021) && x_viseur+1 != 128) x_viseur++;
if(IsKeyDown(30020) && x_viseur-1 != 0) x_viseur--;
if(IsKeyDown(30002)) retour = 1;
if(IsKeyDown(SHOOT) && x_viseur>=3 && x_viseur<=29 && y_viseur>=37 && y_viseur<=45) retour = 1; // RETOUR
Sleep(2*vitesse);
}while(!retour);
while(IsKeyDown(SHOOT) || IsKeyDown(30002));
}
// FAIT
void credits()
{
// SPRITES
const unsigned char credits[]={
0x0,0x3,0x0,0x0,0x0,0x1f,0xff,0xff,0xff,0xff,0xfc,0x0,0x0,0x0,0xc0,0x0,
0x0,0x6,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x60,0x0,
0x0,0xc,0x0,0x0,0x0,0x17,0xd2,0xf1,0xce,0x38,0xe4,0x0,0x0,0x0,0x30,0x0,
0x0,0x18,0x0,0x0,0x0,0x11,0x12,0x81,0x29,0x45,0x4,0x0,0x0,0x0,0x18,0x0,
0x2,0x30,0x0,0x0,0x0,0x11,0x1e,0xe1,0xce,0x45,0x34,0x0,0x0,0x0,0xc,0x40,
0x7,0x70,0x0,0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,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x1,0x80,0x0,
0x0,0x1,0x80,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0xc0,0x0,0x0,0x3,
0xc0,0x0,0x0,0x3,
0xe0,0x0,0x0,0x7,
0xf0,0x0,0x0,0xf,
0xf8,0x0,0x0,0x1f,
0xfc,0x0,0x0,0x3f,
0xfe,0x0,0x0,0x7f,
0xff,0x80,0x1,0xff,
0xff,0xf8,0x1f,0xff
};
unsigned int buffet[1100];
// VARIABLES
int x_viseur, y_viseur;
int vitesse;
int retour;
char buffer[120];
reglages(&vitesse);
Bdisp_AllClr_DDVRAM();
x_viseur = 64;
y_viseur = 32;
retour = 0;
do{
// AFFICHAGE
ML_clear_vram();
PrintMini(83,58,__DATE__,0);
PrintMini(98,52,__TIME__,0);
memcpy(buffet, ML_vram_adress(), 1024);
ML_rectangle(0,0,128,64,0, ML_BLACK, ML_BLACK);
ML_bmp_and_cl(viseur, x_viseur-16, y_viseur-16, 32, 32);
ML_bmp_or(buffet, 0, 0, 128, 64);
ML_bmp_or(credits, 0, 0, 128, 64);
ML_display_vram();
// GESTION DES TOUCHES
if(IsKeyDown(30023) && y_viseur+1 != 64) y_viseur++;
if(IsKeyDown(30018) && y_viseur-1 != 0) y_viseur--;
if(IsKeyDown(30021) && x_viseur+1 != 128) x_viseur++;
if(IsKeyDown(30020) && x_viseur-1 != 0) x_viseur--;
if(IsKeyDown(30002)) retour = 1;
if(IsKeyDown(SHOOT) && x_viseur>=3 && x_viseur<=29 && y_viseur>=37 && y_viseur<=45) retour = 1; // RETOUR
Sleep(2*vitesse);
}while(!retour);
while(IsKeyDown(SHOOT) || IsKeyDown(30002));
}
void lect_scores(int* scores)
{
unsigned int key;
int i;
int handle;
char buffer[50];
char *ch = calloc(4,1);
FONTCHARACTER filename[]={'\\','\\','f','l','s','0','\\','s','n','i','p','r','.','s','c','r',0};
handle = Bfile_OpenFile(filename,_OPENMODE_READ);
// SI FICHIER OUVERT
if(handle!=-1){
for(i=0;i<5;i++)
{
Bfile_ReadFile(handle,ch,3,-1);
scores[i] = atoi(ch);
}
}
// SINON CREATION
else{
//*vitesse = 5;
SaveDisp(1);
Bdisp_AllClr_DDVRAM();
Bfile_CreateFile(filename, 8);
handle = Bfile_OpenFile(filename,_OPENMODE_READWRITE);
// sprintf(buffer,"000-000-000-000-000");
sprintf(buffer,"999326249125095");
Bfile_WriteFile(handle,buffer,15);
locate(1,1);
Print("Un fichier a ete cree");
locate(6,2);
Print("snipr.scr");
locate(1,3);
Print(" Merci de ne pas le");
locate(1,4);
Print("supprimer.");
locate(5,6);
Print("Press [ExE]");
do{
GetKey(&key);
}while(key!=30004);
lect_scores(scores);
RestoreDisp(1);
}
Bfile_CloseFile(handle);
}
// A REVOIR
void quitter()
{
Bdisp_AllClr_DDVRAM();
PrintXY(1,1,"GooD ByE",0);
ML_display_vram();
Sleep(500);
Bdisp_AllClr_DDVRAM();
}
#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum){ return INIT_ADDIN_APPLICATION(isAppli, OptionNum);}
#pragma section
#include "MonochromeLib.h"
#include "jeu.h"
#include "windows.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void jeu_solo()
{
// DECLARATION DES VARIABLES UTILES
int quitter = 0;
int niveau = 0;
int temps = 0;
int nbr_PNJ = 0;
int score = 0;
int PNJ_xy[11];
int role_PNJ[6];
int dir_PNJ[6];
int vitesse;
// DECLARATION DES AUTRES VARIABLES
int nbr = 0;
// INITIALISATION DE RAND()
srand(RTC_getTicks());
// LECTURE DES REGLAGES
reglages(&vitesse);
do{
niveau++;
// AFFICHE DU DECOMPTE
decompte(niveau);
// INITIALISATION DU NIVEAU
switch(niveau){
case 1:
fond(1);
temps = 100;
nbr_PNJ = 3;
// PNJ1
PNJ_xy[0] = 26;
PNJ_xy[1] = 28;
dir_PNJ[0]= 0; // G
// PNJ2
PNJ_xy[2] = 60;
PNJ_xy[3] = 28;
dir_PNJ[1]= 1; // D
// PNJ3
PNJ_xy[4] = 118;
PNJ_xy[5] = 28;
dir_PNJ[2]= 1; // D
break;
default:
quitter = 1;
}
RestoreDisp(1);
for(nbr = 0; nbr < nbr_PNJ; nbr ++) role_PNJ[nbr] = 0;
// VICTIME
nbr = rand_int(nbr_PNJ);
role_PNJ[nbr]=1;
ML_rectangle(PNJ_xy[2*nbr]+1,PNJ_xy[2*nbr+1]+1,PNJ_xy[2*nbr]+3,PNJ_xy[2*nbr+1]+3,0, ML_CHECKER, ML_BLACK);
// TUEUR
do{
nbr = rand_int(nbr_PNJ);
if(role_PNJ[nbr]==0){
role_PNJ[nbr]=2;
// ML_rectangle(PNJ_xy[2*nbr]+1,PNJ_xy[2*nbr+1]+1,PNJ_xy[2*nbr]+3,PNJ_xy[2*nbr+1]+3,0, ML_CHECKER, ML_CHECKER);
break;
}
}while(1);
SaveDisp(1);
jouer(temps, vitesse, nbr_PNJ, PNJ_xy, role_PNJ, dir_PNJ, &quitter);
}while(!quitter);
}
// MOTEUR JEU ---- A FAIRE
void jouer(int temps, int vitesse, int nbr_PNJ, int* PNJ_xy, int* role_PNJ, int* dir_PNJ, int* quitter)
{
// DECLARATION DES VARIABLES
int perdu = 0;
int x_viseur = 64;
int y_viseur = 32;
int buffet[1100];
char affichage[10];
int nbr;
unsigned int key;
// SPRITES
const unsigned char viseur[]={
0xff,0xf8,0x1f,0xff,
0xff,0x80,0x1,0xff,
0xfe,0x0,0x0,0x7f,
0xfc,0x0,0x0,0x3f,
0xf8,0x0,0x0,0x1f,
0xf0,0x0,0x0,0xf,
0xe0,0x0,0x0,0x7,
0xc0,0x0,0x0,0x3,
0xc0,0x0,0x0,0x3,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x1,0x80,0x0,
0x0,0x1,0x80,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0x80,0x0,0x0,0x1,
0xc0,0x0,0x0,0x3,
0xc0,0x0,0x0,0x3,
0xe0,0x0,0x0,0x7,
0xf0,0x0,0x0,0xf,
0xf8,0x0,0x0,0x1f,
0xfc,0x0,0x0,0x3f,
0xfe,0x0,0x0,0x7f,
0xff,0x80,0x1,0xff,
0xff,0xf8,0x1f,0xff
};
const unsigned char bras_d[]={
0x1c,
0xf0,
0xe0
};
const unsigned char bras_g[]={
0xe0,
0x3c,
0x1c
};
const unsigned char pan[]={
0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,
0xe1,0xe1,0xd1,0xef,
0xee,0xde,0xce,0xef,
0xee,0xde,0xde,0xef,
0xee,0xde,0xde,0xef,
0xe1,0xc0,0xde,0xef,
0xef,0xde,0xde,0xef,
0xef,0xde,0xde,0xef,
0xef,0xde,0xde,0xff,
0xef,0xde,0xde,0xef,
0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff
};
do{
temps --;
// AFFICHAGES
ML_clear_vram();
RestoreDisp(1);
memcpy(buffet, ML_vram_adress(), 1024);
ML_rectangle(0,0,128,64,0, ML_BLACK, ML_BLACK);
ML_bmp_and_cl(viseur, x_viseur-16, y_viseur-16, 32, 32);
ML_bmp_or(buffet, 0, 0, 128, 64);
// affichage du tueur a la fin du temps
if(temps<=50){
for(nbr=0; nbr<(nbr_PNJ*2); nbr+=2){
if(role_PNJ[(int)(nbr/2)]==2){
if(dir_PNJ[(int)(nbr/2)]==1) ML_bmp_or(bras_g, PNJ_xy[nbr]-5, PNJ_xy[nbr+1]+5, 7, 3);
else ML_bmp_or(bras_d, PNJ_xy[nbr]+4, PNJ_xy[nbr+1]+5, 7, 3);
}
}
}
ML_display_vram();
// GESTIONS TOUCHES
if(IsKeyDown(30023) && y_viseur+1 != 64) y_viseur++;
if(IsKeyDown(30018) && y_viseur-1 != 0) y_viseur--;
if(IsKeyDown(30021) && x_viseur+1 != 128) x_viseur++;
if(IsKeyDown(30020) && x_viseur-1 != 0) x_viseur--;
if(IsKeyDown(30002)) *quitter = 1;
if(IsKeyDown(SHOOT)){
*quitter = 0;
for(nbr=0;nbr<(nbr_PNJ*2);nbr+=2){
if(y_viseur+1 < PNJ_xy[nbr+1]+5 && y_viseur-1 > PNJ_xy[nbr+1] && x_viseur+1 < PNJ_xy[nbr]+5 && x_viseur-1 > PNJ_xy[nbr]){
if(role_PNJ[(int)(nbr/2)]!=2) *quitter = 1;
if(role_PNJ[(int)(nbr/2)]==2) *quitter = 2;
}
}
if(x_viseur<64) ML_bmp_and(pan, 96, 48, 31, 15);
else ML_bmp_and(pan, 1, 1, 31, 15);
}
Sleep(2*vitesse);
}while(*quitter==0);
ML_display_vram();
SaveDisp(2);
fini(*quitter, x_viseur, y_viseur);
RestoreDisp(1);
ML_display_vram();
if(*quitter == 2) *quitter = 0;
Sleep(250);
}
// MEMORISATION DU FOND
void fond(int numero)
{
const unsigned char niveau_1[]={
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf,0x80,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f,0xc0,0x0,0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0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
};
Bdisp_AllClr_DDVRAM();
switch(numero){
case 1:
ML_bmp_or(niveau_1, 0, 0, 128, 64);
break;
default:
ML_bmp_or(niveau_1, 0, 0, 128, 64);
}
// SAUVEGARDE DU SPRITE
ML_display_vram();
SaveDisp(1);
}
// SI IL Y A EU UN TIR
void fini(int perdu, int x_viseur, int y_viseur)
{
const unsigned char blood[]={
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,
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,0xfe,
0xff,0xff,0xff,0xfe,
0xff,0xff,0xff,0xfe,
0x7f,0xff,0xff,0xfe,
0x7f,0xff,0xff,0xbe,
0x3f,0xff,0xff,0xbe,
0x3f,0xff,0xe7,0xbe,
0x3f,0xff,0xe7,0xbe,
0x3f,0xff,0xe7,0xbe,
0x3f,0xff,0xe7,0xbe,
0x3f,0xf7,0xe7,0xbe,
0x3e,0xf7,0xe7,0x9c,
0x3e,0xf7,0xe3,0x0,
0x1c,0xf7,0xe0,0x0,
0x0,0xf7,0xe0,0x0,
0x0,0xf7,0xe0,0x0,
0x0,0xf7,0xc0,0x0,
0x0,0x63,0x80,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0
};
int nombre, taille, diametre, pas;
if(x_viseur >=63 ) diametre = x_viseur;
else diametre = 127 - x_viseur;
if(diametre >= 75) pas = 3;
else pas = 2;
if(perdu==1){
for(nombre = 0; nombre <49; nombre ++){
RestoreDisp(2);
ML_bmp_or_cl(blood, x_viseur-16, y_viseur-64 + nombre, 32, 64);
ML_display_vram();
Sleep(20);
}
ML_rectangle(1,28,126,37,1, ML_BLACK, ML_WHITE);
PrintMini(23,30,"La victime y est passee",0);
ML_display_vram();
}
else{
for(taille=1; taille < diametre; taille+=pas){
RestoreDisp(1);
for(nombre=taille; nombre < diametre; nombre+=2){
ML_circle(x_viseur, y_viseur, nombre+16, ML_BLACK);
ML_circle(x_viseur, y_viseur, nombre+17, ML_BLACK);
}
ML_display_vram();
}
}
while(IsKeyUp(30004));
}
// LECTURE DES REGLAGES SUR LE FICHIER
void reglages(int* vitesse)
{
unsigned int key;
int handle;
char buffer[7];
FONTCHARACTER filename[]={'\\','\\','f','l','s','0','\\','s','n','i','p','r','.','r','g','l',0};
handle = Bfile_OpenFile(filename,_OPENMODE_READ);
// SI FICHIER OUVERT
if(handle!=-1){
Bfile_ReadFile(handle,buffer,5,0);
// LECTURE VITESSE ENREGISTREE
switch(buffer[0]){
case '0': *vitesse = 9;
break;
case '1': *vitesse = 8;
break;
case '2': *vitesse = 7;
break;
case '3': *vitesse = 6;
break;
case '4': *vitesse = 5;
break;
case '5': *vitesse = 4;
break;
case '6': *vitesse = 3;
break;
case '7': *vitesse = 2;
break;
case '8': *vitesse = 1;
break;
case '9': *vitesse = 0;
break;
default : *vitesse = 5;
}
}
// SINON CREATION
else{
*vitesse = 5;
Bfile_CreateFile(filename, 8);
handle = Bfile_OpenFile(filename,_OPENMODE_READWRITE);
locate(1,1);
Print("Un fichier a ete cree");
locate(6,2);
Print("snipr.rgl");
locate(1,3);
Print(" Merci de ne pas le");
locate(1,4);
Print("supprimer.");
locate(5,6);
Print("Press [ExE]");
do{
GetKey(&key);
}while(key!=30004);
}
Bfile_CloseFile(handle);
}
// AFFICHAGE DU DECOMPTE
void decompte(int niveau)
{
int nbr;
char affichage[20];
ML_rectangle(0,0,128,64,0, ML_BLACK, ML_BLACK);
windows_1(40,20,88,40);
sprintf(affichage,"Niveau: %d", niveau);
PrintMini(47,24,affichage,1);
SaveDisp(1);
for(nbr=3;nbr>=0;nbr--){
RestoreDisp(1);
sprintf(affichage," %d ", nbr);
PrintMini(58,30,affichage,1);
Sleep(1000);
ML_display_vram();
}
RestoreDisp(1);
PrintMini(56,30," GO",1);
ML_display_vram();
Sleep(500);
}
// FONCTIONS POUR L ALEATOIRE
int RTC_getTicks()
{
static int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070};
static int (*SysCall)(int R4, int R5, int R6, int R7, int FNo ) = (void*)&SysCallCode;
return (*SysCall)(0, 0, 0, 0, 0x3B);
}
int rand_int(int max)
{
return rand() % max;
}
Citer : Posté le 26/04/2014 18:58 | #
Ben oui, tu crées le fichier avec 8 octets et tu en colles 15 dedans.
Pas étonnant qu'à partir du troisième score (9 octets) ça plante.
Citer : Posté le 26/04/2014 19:03 | #
Ca marche impec
Merci (encore une fois )
Ajouté le 27/04/2014 à 16:09 :
Le soucis si j'enregistre les scores comme ça c'est que si après je dois écrire un score de 45 par exemple faut que je mette 045 dans le fichier...
Et pour mettre le 0 devant je sais pas comment faire
Citer : Posté le 27/04/2014 16:17 | #
Tu mets:
#define SCORES 5
void Save(int *s)
{
char ch[20]; // la taille necessaire pour tous tes scores
int i;
for(i=0;i<SCORES;i++) sprintf(ch+3*i,"%03d",*(s+i));
// ecriture
}
Le %3d force 3 caractères, mais 45 deviendrait " 45". Le 0 devant le 3 ("%03d") met des 0 à gauche.
Citer : Posté le 27/04/2014 18:16 | #
Merci c'est exactement ca que je cherchais
Par contre je me demandais quel etait l'interet de :
if(KeyDown(code)){ \
(writemode==0)?sendbyte=(min):((writemode==1)?sendbyte=(maj):sendbyte=(nbr)); \
Serial_WriteByte(sendbyte); \
if(showSended)screen.write(sendbyte); \
while(KeyDown(code) && !repetition){Sleep(1);}}
Par rapport a:
if(KeyDown(code)){
if(writemode==0)sendbyte=(min);
if(writemode==1)sendbyte=(maj);
if(writemode==2)sendbyte=(nbr));
Serial_WriteByte(sendbyte);
if(showSended)screen.write(sendbyte);
while(KeyDown(code) && !repetition){Sleep(1);}
}
}
Citer : Posté le 27/04/2014 18:21 | #
C'est plus rapide.
L'opérateur ternaire est plus optimisé qu'une liste de conditions.
À la limite, il faudrait mettre un switch, mais encore une fois je pense que ce serait plus lent.
Citer : Posté le 27/04/2014 21:10 | #
Encore du boulot pour toi LePhé
Je comprends pas pourquoi la valeur de "curseur" ne bouge pas alors que "chaine" si...
{
int type = 1;
int curseur = 0;
do{
PrintMini(35,30,chaine,0);
ML_display_vram();
rempli_caractere(KEY_CHAR_0,chaine,&curseur,type,'z','Z','0');
rempli_caractere(KEY_CHAR_1,chaine,&curseur,type,'u','U','1');
rempli_caractere(KEY_CHAR_2,chaine,&curseur,type,'v','V','2');
rempli_caractere(KEY_CHAR_3,chaine,&curseur,type,'w','W','3');
rempli_caractere(KEY_CHAR_4,chaine,&curseur,type,'p','P','4');
rempli_caractere(KEY_CHAR_5,chaine,&curseur,type,'q','Q','5');
rempli_caractere(KEY_CHAR_6,chaine,&curseur,type,'r','R','6');
rempli_caractere(KEY_CHAR_7,chaine,&curseur,type,'m','M','7');
rempli_caractere(KEY_CHAR_8,chaine,&curseur,type,'n','N','8');
rempli_caractere(KEY_CHAR_9,chaine,&curseur,type,'o','O','9');
rempli_caractere(KEY_CTRL_XTT,chaine,&curseur,type,'a','A','A');
rempli_caractere(KEY_CHAR_LOG,chaine,&curseur,type,'b','B','B');
rempli_caractere(KEY_CHAR_LN,chaine,&curseur,type,'c','C','C');
rempli_caractere(KEY_CHAR_SIN,chaine,&curseur,type,'d','D','D');
rempli_caractere(KEY_CHAR_COS,chaine,&curseur,type,'e','E','E');
rempli_caractere(KEY_CHAR_TAN,chaine,&curseur,type,'f','F','F');
rempli_caractere(KEY_CHAR_FRAC,chaine,&curseur,type,'g','G','G');
rempli_caractere(KEY_CTRL_FD,chaine,&curseur,type,'h','H','H');
rempli_caractere(KEY_CHAR_LPAR,chaine,&curseur,type,'i','I','(');
rempli_caractere(KEY_CHAR_RPAR,chaine,&curseur,type,'j','J',')');
rempli_caractere(KEY_CHAR_COMMA,chaine,&curseur,type,'k','K',',');
rempli_caractere(KEY_CHAR_STORE,chaine,&curseur,type,'l','L','L');
rempli_caractere(KEY_CHAR_DP,chaine,&curseur,type,' ',' ','.');
rempli_caractere(KEY_CHAR_PLUS,chaine,&curseur,type,'x','X','+');
rempli_caractere(KEY_CHAR_MINUS,chaine,&curseur,type,'y','Y','-');
rempli_caractere(KEY_CHAR_MULT,chaine,&curseur,type,'s','S','*');
rempli_caractere(KEY_CHAR_DIV,chaine,&curseur,type,'t','T','/');
}while(1);
}
void rempli_caractere(int key, char* chaine, int* curseur, int type, char caractere_S, char caractere_A, char caractere_N)
{
if(IsKeyDown(key)){
switch(type){
case 1: chaine[*curseur]=caractere_N; break;
case 2: chaine[*curseur]=caractere_A; break;
case 3: chaine[*curseur]=caractere_S; break;
default: chaine[*curseur]=caractere_N; break;
}
chaine[*curseur+1]='\0';
*curseur++;
while(IsKeyDown(key));
}
}
Citer : Posté le 27/04/2014 21:12 | #
Eh oui !
Et si tu essayais avec
?
Citer : Posté le 27/04/2014 21:16 | #
C'est bon ca passe
Et une fois de plus merci
Ajouté le 29/04/2014 à 00:17 :
Est-ce qu'il existe un type de variable binaire ou ca peut ce faire que avec une chaine ?
Citer : Posté le 29/04/2014 00:33 | #
Un type de variable binaire ? C'est à dire de taille 1 bit ? A ce moment là, pas sur une telle plateforme de base (toute les adresses sont basées sur l'octet, il y aurait des décalages compliqués à gérer)... En revanche tu peux faire comme pour les booleens : tu peux en stocker 8 sur 1 octet avec les opérateurs bits à bits .
Ensuite je ne suis pas sûr d'avoir compris la question .
Citer : Posté le 29/04/2014 01:13 | #
Ben en grosz stocker un octet comme ça: