cleanup to have one branch

This commit is contained in:
Tituya 2021-03-21 23:39:09 +01:00
parent 852f5d9460
commit 92bf210c57
89 changed files with 96 additions and 163 deletions

56
.gitignore vendored Normal file → Executable file
View File

@ -1,55 +1 @@
build-cg/*
# ---> C
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
build-cg/

BIN
AST3.g3a

Binary file not shown.

0
LICENSE Normal file → Executable file
View File

0
Makefile Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

BIN
assets-cg/icon-cg-sel.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

BIN
assets-cg/icon-cg-uns.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

0
assets-cg/img/appear.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 339 B

0
assets-cg/img/appearblock.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 636 B

After

Width:  |  Height:  |  Size: 636 B

0
assets-cg/img/blackout.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

0
assets-cg/img/chock.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 258 B

0
assets-cg/img/chrono1.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 610 B

0
assets-cg/img/chrono2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 607 B

0
assets-cg/img/chrono2appear.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 348 B

After

Width:  |  Height:  |  Size: 348 B

0
assets-cg/img/coin.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

0
assets-cg/img/damaged.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 616 B

0
assets-cg/img/dead.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

0
assets-cg/img/end.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 287 B

0
assets-cg/img/endscreen.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

0
assets-cg/img/ice.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 554 B

0
assets-cg/img/key1.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 266 B

After

Width:  |  Height:  |  Size: 266 B

0
assets-cg/img/key2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 258 B

0
assets-cg/img/key2block.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 582 B

0
assets-cg/img/key2blockvoid.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 259 B

0
assets-cg/img/keyblock.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 590 B

After

Width:  |  Height:  |  Size: 590 B

0
assets-cg/img/medals.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

0
assets-cg/img/menu.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

0
assets-cg/img/new.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets-cg/img/player.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 656 B

After

Width:  |  Height:  |  Size: 675 B

0
assets-cg/img/solid_0.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 461 B

After

Width:  |  Height:  |  Size: 461 B

0
assets-cg/img/speedrun.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

0
assets-cg/img/switch.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

View File

@ -1,11 +1,17 @@
#!/usr/bin/bash
#!/bin/sh
echo "making define.h from editor"
rm include/define.h
echo "#define LEVEL_MAX $(ls editor/levels/[^0]*.lvl | wc -l)
#define PLAYER_HEIGHT 11
#define FPS 70" > include/define.h
echo "done"
echo "making setlevel.c from editor"
rm src/setlevel.c
python compile_level.py
python3 compile_level.py
echo "done"
echo "making times.c from times.lvl"
rm src/times.c
python time.py
python3 time.py
echo "done"
echo "building for cg"
fxsdk build-cg

20
compile_level.py Normal file → Executable file
View File

@ -1,7 +1,7 @@
ids = 0
save = open("src/setlevel.c","w+")
save.write("#include \"setlevel.h\"\n#include <gint/std/string.h>\n#include <gint/display.h>\nvoid set_level(int id_level, char level[], int *startx, \
save.write("#include \"setlevel.h\"\n#include <gint/std/string.h>\nvoid set_level(int id_level, char level[], int *startx, \
int *starty, char *gravity, int *appear, int *disappear){\nswitch(id_level){")
while 1:
try:
@ -45,23 +45,9 @@ while 1:
except FileNotFoundError:
break
f = open("times.lvl","r+")
lvm = open(f"include/define.h","r")
ids=f.readlines()
names=[]
for i in ids:
names.append(i.rstrip())
for i in range(int(''.join(list(filter(str.isdigit, lvm.readline()))))):
hop=names[i].find("-")
if hop!=-1: names[i]=names[i][hop+1:]
else: names[i]=""
save.write("}}\nvoid del_level(char level[])\n{memcpy(level,\"\
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",350);}\n\n\
void set_levelname(int id_level)\n{\nchar *levelname[] = {")
save.write(("\""+'","'.join(names)+'"};\ndprint_opt(180, 25, C_RED, C_BLACK, DTEXT_LEFT, DTEXT_TOP, \"%s\", levelname[id_level-1]);\n}'))
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",350);}")
#copy the textures from editor
import shutil
shutil.copytree("editor/img","assets-cg/img", dirs_exist_ok=True)
shutil.copytree("editor/img","assets-cg/img", dirs_exist_ok=True)

View File

@ -1,3 +1,3 @@
#!/usr/bin/bash
echo "opening editor"
python editor/AST3generator.py
python3 editor/AST3generator.py

6
editor/AST3generator.py Normal file → Executable file
View File

@ -2,6 +2,7 @@
Programme de création de niveau pour A Switch to the top fait par Tituya
Pour le CPC#26
"""
# coding: utf-8
import pygame
from pygame.locals import *
@ -134,7 +135,6 @@ suite=["0","1","d","s","e","k","3","K","a","c","m","t","l","b","B","i","S","h"]
lvm = open(f"include/define.h","r")
id_level = 0
id_level_max = int(''.join(list(filter(str.isdigit, lvm.readline()))))
gravityid = 6
disa = 10
app = 13
@ -173,7 +173,7 @@ while securite==False:
elif event.type == pygame.KEYDOWN:
carac= event.dict['unicode']
if carac == "d":
if id_level_max>id_level: id_level+=1
id_level+=1
load(id_level)
place()
if carac == "q":
@ -244,4 +244,4 @@ while securite==False:
grille[y][x]="0"
pygame.draw.rect(fenetre,(255,255,255),((52*x, 52*y), (55, 55)))
place()
write()
write()

0
editor/README.md Normal file → Executable file
View File

0
editor/img/appear.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 339 B

0
editor/img/appearblock.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 636 B

After

Width:  |  Height:  |  Size: 636 B

0
editor/img/blackout.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

0
editor/img/chock.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 258 B

0
editor/img/chrono1.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 610 B

0
editor/img/chrono2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 607 B

0
editor/img/chrono2appear.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 348 B

After

Width:  |  Height:  |  Size: 348 B

0
editor/img/coin.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

0
editor/img/damaged.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 616 B

0
editor/img/dead.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

0
editor/img/end.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 287 B

0
editor/img/ice.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 554 B

0
editor/img/key1.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 266 B

After

Width:  |  Height:  |  Size: 266 B

0
editor/img/key2.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 258 B

0
editor/img/key2block.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 582 B

0
editor/img/key2blockvoid.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 259 B

0
editor/img/keyblock.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 590 B

After

Width:  |  Height:  |  Size: 590 B

BIN
editor/img/player.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 656 B

After

Width:  |  Height:  |  Size: 675 B

0
editor/img/solid_0.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 461 B

After

Width:  |  Height:  |  Size: 461 B

0
editor/img/switch.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

1
editor/levels/0.lvl Normal file → Executable file
View File

@ -1,3 +1,4 @@
111111111111111111111111100000000c300000000000100000000000c3000000K0k0l1000111ddd1111aaa111111111h11111ddd1111aaa1ddddd00000110000001110001d000000000110s00001110001d000000000111111001110001d0011d1100110b01001110001d00e000000110S01001110001d000000000110001001110001d011111000100t01000m00001d000000000000001000m00001ddddd00000011111111111111111111111116
9
13

0
editor/levels/1.lvl Normal file → Executable file
View File

0
editor/levels/10.lvl Normal file → Executable file
View File

0
editor/levels/11.lvl Normal file → Executable file
View File

0
editor/levels/12.lvl Normal file → Executable file
View File

0
editor/levels/13.lvl Normal file → Executable file
View File

0
editor/levels/14.lvl Normal file → Executable file
View File

2
editor/levels/15.lvl Normal file → Executable file
View File

@ -1,4 +1,4 @@
i011100dd1111dddm111ddmd1i01d1000000010S0011100S01i01d100000001000000000001i01d1cc111001hh1c11111001i01ddddddi00i000bddd00001i01dd1133i00i000lddd000K1100000000i00i00001d110011300000000i00100331d100003300000010i001s03t1d1000031111100hki0011111ddd1BB1110S01hh11100m0000aaa0000110001001d100m000000000001100e1001d100m0aaa000aaa0110d11001111111ddddddddd116
5
4
7

1
editor/levels/2.lvl Normal file → Executable file
View File

@ -1,3 +1,4 @@
1dddddd100111111111111111000000000011111000000000000000000l01100c00000000001aaaaaaa111100c00000000011dddddddddd1001aaaaaaaaa11cccccccccc1001ddddddddd10000000000d1331000000aa000000000000s10e1k0000000001ccccccccc111111111113311100000000011001000000000110000000001100b0000000001100000000011t0b00000000011000K0000011111aaaaaaaaa1111111110011111ddddddddd16
12
1

0
editor/levels/3.lvl Normal file → Executable file
View File

0
editor/levels/4.lvl Normal file → Executable file
View File

1
editor/levels/5.lvl Normal file → Executable file
View File

@ -1,3 +1,4 @@
000000000000000000000000000000000000000000000000t000000000000000000000000000011dd111111111111111110000100000100000010000001000011cc001s0000d00000001000010000e111dd0100000dd100001001111000d0000000dd100001000001000111d000ddd1000010000000000000000ddd1000011111111111d111B11111000000000000000000000000000000000000000000000000000000000000000000000000000006
12
6

0
editor/levels/6.lvl Normal file → Executable file
View File

0
editor/levels/7.lvl Normal file → Executable file
View File

0
editor/levels/8.lvl Normal file → Executable file
View File

0
editor/levels/9.lvl Normal file → Executable file
View File

0
include/collide.h Normal file → Executable file
View File

0
include/drawlevel.h Normal file → Executable file
View File

0
include/menu.h Normal file → Executable file
View File

2
include/save.h Normal file → Executable file
View File

@ -1,5 +1,5 @@
void savefile(void);
int loadtime(int a);
int loadtime(int idlevel);
void loadfile(void);
void restore(void);
void savetimes(float framelevel, int id_level);

1
include/setlevel.h Normal file → Executable file
View File

@ -1,4 +1,3 @@
void set_level(int id_level, char level[], int *startx, int *starty, char *gravity, int *appear, int *disappear);
void set_gravity(int id_level, char *default_gravity);
void del_level(char level[]);
void set_levelname(int id_level);

0
include/times.h Normal file → Executable file
View File

0
project.cfg Normal file → Executable file
View File

0
src/collide.c Normal file → Executable file
View File

3
src/drawlevel.c Normal file → Executable file
View File

@ -27,7 +27,6 @@ extern bopti_image_t img_appear; //appear block
extern bopti_image_t img_appearblock; //appear block
extern bopti_image_t img_chrono2appear; //appear block
extern bopti_image_t img_endscreen;
extern bopti_image_t img_new;
@ -101,7 +100,7 @@ void draw_level(char level[])
dimage(x,y,&img_appearblock);
break;
case 'y': //appear blocks
dimage(x,y,&img_appearblock);
dimage(x,y,&img_appear);
break;
case 'm': //chronoappear blocks
dimage(x,y,&img_chrono2appear);

6
src/main.c Normal file → Executable file
View File

@ -53,7 +53,7 @@ void game(int *id_level, char mode, char *type)
int disappear = 13;
float vspd = 1.0;
float hspd = 0;
float hspd = 0.0;
if(*id_level==10 && *type!=3) *type = 2;
else if(*type!=3) *type = 1;
extern bopti_image_t img_speedrun;
@ -180,6 +180,8 @@ void game(int *id_level, char mode, char *type)
death_count++;
double_check = 1;
framelevel = 0;
if(*id_level == 1 && !mode)
frame = 0;
}
//Collide with the end
if(collide_end(player_x, player_y, level))
@ -395,7 +397,7 @@ void game(int *id_level, char mode, char *type)
float framefloat = framelevel;
draw_end(framelevel, *id_level, 0);
savetimes(framefloat, *id_level);
sleep_ms(5000);
sleep_ms(3000);
}
if(!speed_menu(id_level))
{

1
src/menu.c Normal file → Executable file
View File

@ -80,7 +80,6 @@ char speed_menu(int *id_level)
dprint(80,20,C_BLACK,"Level : %d",*id_level);
if(sto != 0) dprint(194,60,C_RED, "%.2j", sto);
else dprint(202,60,C_RED, "/");
set_levelname(*id_level);
if(*id_level == 14) dprint_opt(180, 8, C_RGB(0,255,255), C_BLACK, DTEXT_LEFT, DTEXT_TOP, "VVVVVV");
dupdate();
if (keydown_any(KEY_SHIFT, KEY_EXE, 0))

70
src/save.c Normal file → Executable file
View File

@ -2,80 +2,78 @@
#include <gint/gint.h>
#include "define.h"
#include "drawlevel.h"
int retcode;
int valeur = 0;
int times[LEVEL_MAX]; //moche et je le sais... A essayer l'allocution dynamique
int id_leveltab = 0;
int times[LEVEL_MAX];
static const uint16_t *filepath = u"\\\\fls0\\AST3.sav";
/*savefile() write the time of all the player's times in the savefile
savefile() is long to execute. That's why it must be call once per new record only to avoid loading times.*/
/* savefile() write the time of all the player's times in the savefile.
* savefile() is long to execute. That's why it must be call once per
* new record only to avoid loading times. */
void savefile(void)
{
uint16_t *filepath = u"\\\\fls0\\AST3.sav";
int descriptor;
descriptor = BFile_Open(filepath, BFile_WriteOnly);
for(int i = 0; i != 15; i++) BFile_Write(descriptor, &times[i], sizeof(times[i]));
BFile_Write(descriptor, times, sizeof(times));
BFile_Close(descriptor);
}
/*loadfile() is only call by the function loadtime() because loadtime() set the value of "valeur".
It store in the global retcode the time of the player. This function is call once per level
in the level selection menu to avoid loading time.*/
/* loadfile() is only called by the function loadtime() because
* loadtime() set the value of "id_leveltab". It store in the global retcode
* the time of the player. This function is called once per level in the
* level selection menu to avoid loading time. */
void loadfile(void)
{
int descriptor;
uint16_t *filepath = u"\\\\fls0\\AST3.sav";
descriptor = BFile_Open(filepath, BFile_ReadOnly);
BFile_Read(descriptor, &retcode, 4, 4*valeur);
BFile_Read(descriptor, &retcode,
sizeof(times[0]), sizeof(times[0]) * id_leveltab);
BFile_Close(descriptor);
}
/*savetimes() is call when the player has reached the end of a level.
If his time is better than the save time, it will call the function savefile
else, nothing append to avoid loading time*/
/* savetimes() is call when the player has reached the end of a level.
* If his time is better than the save time, it will call the function
* savefile() else, nothing append to avoid loading time. */
void savetimes(float framelevel, int id_level)
{
if(times[id_level-1]>(int)(framelevel/FPS*100) || times[id_level-1]==0)
if(times[id_level - 1] > (int)(framelevel / FPS * 100) ||
times[id_level - 1] == 0)
{
times[id_level-1]=(int)(framelevel/FPS*100);
times[id_level - 1] = (int)(framelevel / FPS * 100);
draw_end((int)framelevel, id_level, 1);
gint_switch(savefile);
}
}
/*restore() is call when the app is load, it will create the save file if it doesn't exist.
If the file exist, it will read all times from the save and store them in the global times[]*/
void restore()
/* restore() is call when the app is load, it will create the save file
* if it doesn't exist. If the file exist, it will read all times from
* the save and store them in the global times[] */
void restore(void)
{
uint16_t *filepath = u"\\\\fls0\\AST3.sav";
struct BFile_FileInfo fileInfo;
int handle;
uint16_t foundpath[30];
int size = 80;
int size = sizeof(times);
int descriptor;
char checkfile = BFile_FindFirst(filepath, &handle, foundpath, &fileInfo);
BFile_FindClose(handle);
if(checkfile == -1) BFile_Create(filepath, BFile_File, &size);
else
{
if(checkfile == -1)
BFile_Create(filepath, BFile_File, &size);
else {
descriptor = BFile_Open(filepath, BFile_ReadOnly);
for(int i = 0; i != 15; i++)
{
BFile_Read(descriptor, &retcode, 4, 4*i);
times[i] = (int)retcode;
}
BFile_Read(descriptor, times, sizeof(times), 0);
BFile_Close(descriptor);
}
}
/*loadtime is changing the current value of the global "valeur" to set it to the current level
then it execute loadfile and read and stock in the global retcode 4 bits
at the place 4*level (times are in 4 bits) */
int loadtime(int a)
/* loadtime() is changing the current value of the global "id_leveltab" to
* set it to the current level then it execute loadfile and read and
* stock in the global retcode 4 bytes at the place 4*level (times are in
* 4 bytes) */
int loadtime(int idlevel)
{
valeur = a;
id_leveltab = idlevel;
gint_switch(loadfile);
return (int)retcode;
}

View File

@ -1,6 +1,5 @@
#include "setlevel.h"
#include <gint/std/string.h>
#include <gint/display.h>
void set_level(int id_level, char level[], int *startx, int *starty, char *gravity, int *appear, int *disappear){
switch(id_level){case 0:
memcpy(level,"111111111111111111111111100000000c300000000000100000000000c3000000K0k0l1000111ddd1111aaa111111111h11111ddd1111aaa1ddddd00000110000001110001d000000000110s00001110001d000000000111111001110001d0011d1100110b01001110001d00e000000110S01001110001d000000000110001001110001d011111000100t01000m00001d000000000000001000m00001ddddd0000001111111111111111111111111",350);
@ -59,7 +58,7 @@ memcpy(level,"1111111111111ddd11iK1d00100000d111000000011it1d00000000d1000000000
break;
case 15:
memcpy(level,"i011100dd1111dddm111ddmd1i01d1000000010S0011100S01i01d100000001000000000001i01d1cc111001hh1c11111001i01ddddddi00i000bddd00001i01dd1133i00i000lddd000K1100000000i00i00001d110011300000000i00100331d100003300000010i001s03t1d1000031111100hki0011111ddd1BB1110S01hh11100m0000aaa0000110001001d100m000000000001100e1001d100m0aaa000aaa0110d11001111111ddddddddd11",350);
*appear=5;
*appear=4;
*disappear=7;
break;
}
@ -127,10 +126,4 @@ case 15:
break;
}}
void del_level(char level[])
{memcpy(level,"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",350);}
void set_levelname(int id_level)
{
char *levelname[] = {"KikooDX","KikooDX","KikooDX","KikooDX","KikooDX","KikooDX","KikooDX","KikooDX","Massena","Massena","Tituya","Tituya","Tituya","Tituya","Tituya"};
dprint_opt(180, 25, C_RED, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "%s", levelname[id_level-1]);
}
{memcpy(level,"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",350);}

View File

@ -4,11 +4,11 @@
#include <gint/keyboard.h>
extern bopti_image_t img_medals;
float level_time[] = {5.86,8.76,5.80,3.52,3.58,8.62,6.73,7.65,9.62,6.04,6.23,10.78,5.39,8.35,7.45};
void check_medal(unsigned int frame_level, int id_level, int x, int y)
{
float time=1.0;
float framefloat = frame_level;
float level_time[] = {5.80,8.62,5.14,3.22,3.25,8.20,6.60,7.18,9.20,5.22,6.04,10.38,5.34,7.61,6.05};
time = level_time[id_level-1];
if(frame_level/FPS < (unsigned int)time || (frame_level/FPS <= (unsigned int)time &&
@ -25,7 +25,7 @@ void draw_time(int id_level)
{
dclear(C_WHITE);
float time=1.0;
float level_time[] = {5.80,8.62,5.14,3.22,3.25,8.20,6.60,7.18,9.20,5.22,6.04,10.38,5.34,7.61,6.05};
time = level_time[id_level-1];
dsubimage(172,90,&img_medals,36,0,12,12,DIMAGE_NONE);

30
time.py Normal file → Executable file
View File

@ -9,23 +9,28 @@ ids=f.readlines()
times=[]
for i in ids:
times.append(i.rstrip())
for i in range(int(''.join(list(filter(str.isdigit, lvm.readline()))))):
hop=times[i].find("-")
if hop!=-1: times[i]=times[i][:hop]
try:
for i in range(int(''.join(list(filter(str.isdigit, lvm.readline()))))):
hop=times[i].find("-")
if hop!=-1: times[i]=times[i][:hop]
except IndexError:
times.append("0.00")
d.write("#include \"times.h\"\n\
#include \"define.h\"\n\
#include <gint/display.h>\n\
#include <gint/keyboard.h>\n\n\
extern bopti_image_t img_medals;\n\
void check_medal(unsigned int frame_level, int id_level, int x, int y)\n\
{\n\
float time=1.0;\n\
float framefloat = frame_level;\n\
float level_time[] = {")
d.write(f"{','.join(times)}")
d.write("};\ntime = level_time[id_level-1];\n\n\
d.write("};\n\
void check_medal(unsigned int frame_level, int id_level, int x, int y)\n\
{\n\
float time=1.0;\n\
float framefloat = frame_level;")
d.write("\ntime = level_time[id_level-1];\n\n\
if(frame_level/FPS < (unsigned int)time || (frame_level/FPS <= (unsigned int)time && \n\
(unsigned int)((framefloat)/FPS*100-frame_level/FPS*100) <= (unsigned int)((time)*100-(int)(time)*100))) dsubimage(x+45,y,&img_medals,36,0,12,12,DIMAGE_NONE);\n\
if(frame_level/FPS < (unsigned int)(time*"+str(gold)+") || (frame_level/FPS <= (unsigned int)(time*"+str(gold)+") && \n\
@ -39,12 +44,9 @@ if(frame_level/FPS < (unsigned int)(time*"+str(bronze)+") || (frame_level/FPS <=
void draw_time(int id_level)\n\
{\n\
dclear(C_WHITE);\n\
float time=1.0;\n\
float level_time[] = {")
float time=1.0;\n")
d.write(f"{','.join(times)}")
d.write("};\ntime = level_time[id_level-1];\n\n\
d.write("\ntime = level_time[id_level-1];\n\n\
dsubimage(172,90,&img_medals,36,0,12,12,DIMAGE_NONE);\n\
dprint(187,90,C_BLACK,\"%.2j\",(int)(time*100));\n\
dsubimage(172,110,&img_medals,24,0,12,12,DIMAGE_NONE);\n\
@ -55,4 +57,4 @@ dsubimage(172,150,&img_medals,0,0,12,12,DIMAGE_NONE); \n\
dprint(187,150,C_BLACK,\"%.2j\",(int)(time*"+str(bronze)+"*100));\n\
dupdate();\n\
getkey();\n\
}")
}")

30
times.lvl Normal file → Executable file
View File

@ -1,15 +1,15 @@
5.80-KikooDX
8.62-KikooDX
5.14-KikooDX
3.22-KikooDX
3.25-KikooDX
8.20-KikooDX
6.60-KikooDX
7.18-KikooDX
9.20-Massena
5.22-Massena
6.04-Tituya
10.38-Tituya
5.34-Tituya
7.61-Tituya
6.05-Tituya
5.86
8.76
5.80
3.52
3.58
8.62
6.73
7.65
9.62
6.04
6.23
10.78
5.39
8.35
7.45