Compare commits

...

50 Commits
v1.0 ... master

Author SHA1 Message Date
Tituya f70dc2393d update tutorial 2021-06-16 14:40:53 +02:00
Tituya 05e4a78082 adjust times, simplify levels and new name for the savefile 2021-06-16 14:32:47 +02:00
Tituya 238549a5ad fix one bug + arrange level 2021-06-16 03:28:04 +02:00
Tituya 1058fccb15 new level 20 2021-06-15 00:58:49 +02:00
Tituya fe496f10ea fix player clip glitch thanks to KikooDX 2021-06-14 19:27:21 +02:00
Tituya 0e51573101 Merge pull request 'fxlink screenshot' (#11) from KikooDX/AST3_C:master into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/11
2021-05-28 10:59:39 +02:00
KikooDX de682aab2c fxlink screenshot 2021-05-28 10:58:03 +02:00
Tituya 25a2f92e28 level 19, new rough block 2021-05-09 21:58:51 +02:00
Tituya dfc151ff1a Merge pull request 'New timer draw functions and rewrite of times.py' (#10) from KikooDX/AST3_C:master into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/10
2021-05-05 17:07:40 +02:00
KikooDX d6461931ad simplify code 2021-05-05 15:56:14 +02:00
KikooDX d9620de106 This was hell 2021-05-05 15:46:08 +02:00
KikooDX 6a411c7e80 Create new draw_time function replacing the one generated 2021-05-05 14:37:12 +02:00
Tituya b705042fa8 add KikooDX + Times without F6 2021-05-05 13:28:21 +02:00
Tituya 1ebf43efb7 Merge pull request 'friction & acceleration' (#9) from KikooDX/AST3_C:master into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/9
2021-05-05 02:03:09 +02:00
KikooDX 386c727b59 Friction, rem, physics, hugs and candies for everybody! 2021-05-05 01:56:02 +02:00
Tituya 86683554e5 fix recursive main and clean menu 2021-05-05 01:03:02 +02:00
Tituya a4f600c1ff new menu. Ice not working 2021-05-04 01:46:11 +02:00
Tituya 6ed426c4f7 Merge branch 'master' of https://gitea.planet-casio.com/Tituya/AST3_C 2021-05-02 20:35:38 +02:00
Tituya af8d2f9092 Fix TLB glitch + cleanup
new level 18
2021-05-02 20:21:41 +02:00
Tituya f1dd20fe14 cleanup but load fail 2021-05-02 16:25:22 +02:00
Tituya d9d29907e4 Merge pull request 'Reorganized a bit of code' (#8) from KikooDX/AST3_C:master into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/8
2021-05-01 12:41:07 +02:00
KikooDX 38265a910e Reorganized a bit of code
Mainly menu and main code organisation, also created an util.{c,h} for
reusable general purpous functions.
2021-05-01 12:12:14 +02:00
Tituya ebb61f89d0 fix time + level 18 2021-04-30 18:24:59 +02:00
Tituya 81f73656bf dirty fix but it's AST3 so it's ok 2021-04-30 17:32:49 +02:00
Tituya 0e4542bebe Merge pull request 'Upgrade code for gint 2.4' (#7) from KikooDX/AST3_C:gint24 into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/7
2021-04-30 14:16:10 +02:00
KikooDX 5c7cfb4a54 fixup README.md 2021-04-30 14:09:49 +02:00
Tituya 0f7959209d Merge pull request 'Separate generated code from source files' (#6) from KikooDX/AST3_C:master into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/6
2021-04-30 13:55:37 +02:00
KikooDX d3a11b72ea Ran clang-format 2021-04-30 02:12:24 +02:00
KikooDX 1e9c5dc029 Update code to gint 2.4 2021-04-30 02:11:01 +02:00
KikooDX 76b435c535 Separate generated code from source files 2021-04-30 02:04:52 +02:00
Tituya 7df8fd2be3 level 17 + nbswitch block 2021-04-30 01:48:00 +02:00
Tituya 87a373def8 save when quit + new tutorial + Massena's texture 2021-04-29 21:13:13 +02:00
Tituya 5a6ae99ae6 Save when close and Massena's textures by default
- new tutorial
2021-04-27 18:15:35 +02:00
Tituya dd8e25d259 Merge pull request 'Use clang-format to beautify code.' (#5) from KikooDX/AST3_C:master into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/5
2021-03-24 18:44:34 +01:00
KikooDX 2fb7f1db4f Use clang-format to beautify code. 2021-03-23 17:15:35 +01:00
Tituya 4ab913dac3 fix the fix's fix about level 5 2021-03-23 00:07:57 +01:00
Tituya 51624cfc21 fix the fix about CMakeLists.txt 2021-03-23 00:04:01 +01:00
Tituya c9a4e38a21 fix define glitch, back to subimages 2021-03-22 22:50:42 +01:00
Tituya a306f3ec7c Merge pull request 'Switch to new fxsdk build system' (#3) from KikooDX/AST3_C:master into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/3
2021-03-22 21:24:59 +01:00
KikooDX a59390d090 Switch to new fxsdk build system
Wrote CMakeLists.txt, modified scripts, renamed files, etc.
2021-03-22 20:46:37 +01:00
Tituya 56f34cf7a0 Merge pull request 'Stop tracking generated files and binaries' (#2) from KikooDX/AST3_C:master into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/2
2021-03-22 18:41:52 +01:00
KikooDX a3cde28d8f Stop tracking generated files and binaries 2021-03-22 18:36:43 +01:00
Tituya 23b6a75ca0 Not funny at all - level 16 2021-03-22 01:15:33 +01:00
Tituya f4d74f977d fusion master/speedrun 2021-03-22 00:18:54 +01:00
Tituya 92bf210c57 cleanup to have one branch 2021-03-21 23:39:09 +01:00
Tituya 4fc891b571 Merge pull request 'Improved src/save.c + misc' (#1) from KikooDX/AST3_C:master into master
Reviewed-on: https://gitea.planet-casio.com/Tituya/AST3_C/pulls/1
2021-03-21 22:30:48 +01:00
KikooDX 8f2dc27b72 Improved src/save.c + misc
Cleaned up src/save.c, reworked comments.
Use one BFile_* call instead of a for loop when possible.
Use a static constant instead of repeting the path.

Minor .gitignore change.
Change build.sh shebang.
2021-03-21 22:28:31 +01:00
Tituya 852f5d9460 éditeur exporte images 2020-08-29 17:19:05 +02:00
Tituya 102d857fa6 changement blocs + éditeur 2020-08-29 16:40:25 +02:00
Tituya e671d8324c editeur clic droit 2020-08-29 16:11:30 +02:00
110 changed files with 1262 additions and 1293 deletions

7
.clang-format Normal file
View File

@ -0,0 +1,7 @@
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: AlignWithSpaces
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
ColumnLimit: 80

61
.gitignore vendored Normal file → Executable file
View File

@ -1,55 +1,14 @@
build-cg/*
# Build files
build-cg/
# ---> C
# Prerequisites
*.d
# Binaries
*.g3a
# Object files
*.o
*.ko
*.obj
*.elf
# Generated sources
generated/
# Linker output
*.ilk
*.map
*.exp
# fxlink screenshots
fxlink-*.png
# 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
# pictures
pictures/

BIN
AST3.g3a

Binary file not shown.

102
CMakeLists.txt Executable file
View File

@ -0,0 +1,102 @@
# Configure with [fxsdk build-cg], which provide the
# toolchain file and module path of the fxSDK
cmake_minimum_required(VERSION 3.18)
project(AST3)
include(GenerateG1A)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.5 REQUIRED)
include_directories(include generated/include)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_LIST_DIR}/generated/times.c"
COMMENT "Generate generated/times.c"
COMMAND mkdir -p generated && python3 time.py
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS time.py times.lvl generated/include/define.h)
add_custom_command(
OUTPUT
"${CMAKE_CURRENT_LIST_DIR}/generated/setlevel.c"
"${CMAKE_CURRENT_LIST_DIR}/generated/include/define.h"
COMMENT "Generate generated/setlevel.c & generated/include/define.h"
COMMAND mkdir -p generated/include && sh update_levels.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS update_levels.sh compile_levels.py
editor/levels/
editor/levels/0.lvl
editor/levels/1.lvl
editor/levels/2.lvl
editor/levels/3.lvl
editor/levels/4.lvl
editor/levels/5.lvl
editor/levels/6.lvl
editor/levels/7.lvl
editor/levels/8.lvl
editor/levels/9.lvl
editor/levels/10.lvl
editor/levels/11.lvl
editor/levels/12.lvl
editor/levels/13.lvl
editor/levels/14.lvl
editor/levels/15.lvl
editor/levels/16.lvl
editor/levels/17.lvl
editor/levels/18.lvl
editor/levels/19.lvl
editor/levels/20.lvl)
set(SOURCES
src/collide.c
src/drawlevel.c
src/draw_time.c
src/main.c
src/menu.c
src/save.c
src/util.c
src/replace.c
src/friction.c
generated/setlevel.c
generated/times.c)
set(ASSETS)
set(ASSETS_fx)
set(ASSETS_cg
assets-cg/img/appear.png
assets-cg/img/blackout.png
assets-cg/img/chock.png
assets-cg/img/chrono1.png
assets-cg/img/chrono2.png
assets-cg/img/coin.png
assets-cg/img/damaged.png
assets-cg/img/dead.png
assets-cg/img/end.png
assets-cg/img/endscreen.png
assets-cg/img/ice.png
assets-cg/img/key1.png
assets-cg/img/key2.png
assets-cg/img/medals.png
assets-cg/img/menu.png
assets-cg/img/new.png
assets-cg/img/player.png
assets-cg/img/solid.png
assets-cg/img/speedrun.png
assets-cg/img/switch.png
assets-cg/img/nbswitch.png
assets-cg/img/nbswitchlayout.png
assets-cg/img/rough.png)
set(FLAGS -Wall -Wextra -Os)
fxconv_declare_assets(${ASSETS} ${ASSETS_fx} ${ASSETS_cg} WITH_METADATA)
add_executable(${PROJECT_NAME} ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(${PROJECT_NAME} PRIVATE ${FLAGS})
target_link_libraries(${PROJECT_NAME} Gint::Gint)
target_link_options(${PROJECT_NAME} PRIVATE -Wl,-Map=map)
generate_g3a(TARGET ${PROJECT_NAME} OUTPUT "${PROJECT_NAME}.g3a"
NAME "${PROJECT_NAME}" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)

0
LICENSE Normal file → Executable file
View File

194
Makefile
View File

@ -1,194 +0,0 @@
#! /usr/bin/make -f
# Default Makefile for fxSDK add-ins. This file was probably copied there by
# the [fxsdk] program.
#---
#
# Configuration
#
include project.cfg
# Compiler flags
CFLAGSFX := $(CFLAGS) $(CFLAGS_FX) $(INCLUDE)
CFLAGSCG := $(CFLAGS) $(CFLAGS_CG) $(INCLUDE)
# Linker flags
LDFLAGSFX := $(LDFLAGS) $(LDFLAGS_FX)
LDFLAGSCG := $(LDFLAGS) $(LDFLAGS_CG)
# Dependency list generation flags
depflags = -MMD -MT $@ -MF $(@:.o=.d) -MP
# ELF to binary flags
BINFLAGS := -R .bss -R .gint_bss
# G1A and G3A generation flags
NAME_G1A ?= $(NAME)
NAME_G3A ?= $(NAME)
G1AF := -i "$(ICON_FX)" -n "$(NAME_G1A)" --internal="$(INTERNAL)"
G3AF := -n basic:"$(NAME_G3A)" -i uns:"$(ICON_CG_UNS)" -i sel:"$(ICON_CG_SEL)"
ifeq "$(TOOLCHAIN_FX)" ""
TOOLCHAIN_FX := sh3eb-elf
endif
ifeq "$(TOOLCHAIN_CG)" ""
TOOLCHAIN_CG := sh4eb-elf
endif
# fxconv flags
FXCONVFX := --fx --toolchain=$(TOOLCHAIN_FX)
FXCONVCG := --cg --toolchain=$(TOOLCHAIN_CG)
#
# File listings
#
NULL :=
TARGET := $(subst $(NULL) $(NULL),-,$(NAME))
ifeq "$(TARGET_FX)" ""
TARGET_FX := $(TARGET).g1a
endif
ifeq "$(TARGET_CG)" ""
TARGET_CG := $(TARGET).g3a
endif
ELF_FX := build-fx/$(shell basename -s .g1a $(TARGET_FX)).elf
BIN_FX := $(ELF_FX:.elf=.bin)
ELF_CG := build-cg/$(shell basename -s .g3a $(TARGET_CG)).elf
BIN_CG := $(ELF_CG:.elf=.bin)
# Source files
src := $(wildcard src/*.[csS] \
src/*/*.[csS] \
src/*/*/*.[csS] \
src/*/*/*/*.[csS])
assets-fx := $(wildcard assets-fx/*/*)
assets-cg := $(wildcard assets-cg/*/*)
# Object files
obj-fx := $(src:%=build-fx/%.o) \
$(assets-fx:assets-fx/%=build-fx/assets/%.o)
obj-cg := $(src:%=build-cg/%.o) \
$(assets-cg:assets-cg/%=build-cg/assets/%.o)
# Additional dependencies
deps-fx := $(ICON_FX)
deps-cg := $(ICON_CG_UNS) $(ICON_CG_SEL)
# All targets
all :=
ifneq "$(wildcard build-fx)" ""
all += all-fx
endif
ifneq "$(wildcard build-cg)" ""
all += all-cg
endif
#
# Build rules
#
all: $(all)
all-fx: $(TARGET_FX)
all-cg: $(TARGET_CG)
$(TARGET_FX): $(obj-fx) $(deps-fx)
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -o $(ELF_FX) $(obj-fx) $(CFLAGSFX) $(LDFLAGSFX)
$(TOOLCHAIN_FX)-objcopy -O binary $(BINFLAGS) $(ELF_FX) $(BIN_FX)
fxg1a $(BIN_FX) -o $@ $(G1AF)
$(TARGET_CG): $(obj-cg) $(deps-cg)
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -o $(ELF_CG) $(obj-cg) $(CFLAGSCG) $(LDFLAGSCG)
$(TOOLCHAIN_CG)-objcopy -O binary $(BINFLAGS) $(ELF_CG) $(BIN_CG)
mkg3a $(G3AF) $(BIN_CG) $@
# C sources
build-fx/%.c.o: %.c
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -c $< -o $@ $(CFLAGSFX) $(depflags)
build-cg/%.c.o: %.c
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -c $< -o $@ $(CFLAGSCG) $(depflags)
# Assembler sources
build-fx/%.s.o: %.s
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -c $< -o $@
build-cg/%.s.o: %.s
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -c $< -o $@
# Preprocessed assembler sources
build-fx/%.S.o: %.S
@ mkdir -p $(dir $@)
$(TOOLCHAIN_FX)-gcc -c $< -o $@ $(INCLUDE)
build-cg/%.S.o: %.S
@ mkdir -p $(dir $@)
$(TOOLCHAIN_CG)-gcc -c $< -o $@ $(INCLUDE)
# Images
build-fx/assets/img/%.o: assets-fx/img/%
@ mkdir -p $(dir $@)
fxconv --bopti-image $< -o $@ $(FXCONVFX) name:img_$(basename $*) $(IMG.$*)
build-cg/assets/img/%.o: assets-cg/img/%
@ mkdir -p $(dir $@)
fxconv --bopti-image $< -o $@ $(FXCONVCG) name:img_$(basename $*) $(IMG.$*)
# Fonts
build-fx/assets/fonts/%.o: assets-fx/fonts/%
@ mkdir -p $(dir $@)
fxconv -f $< -o $@ $(FXCONVFX) name:font_$(basename $*) $(FONT.$*)
build-cg/assets/fonts/%.o: assets-cg/fonts/%
@ mkdir -p $(dir $@)
fxconv -f $< -o $@ $(FXCONVCG) name:font_$(basename $*) $(FONT.$*)
# Binaries
build-fx/assets/bin/%.o: assets-fx/bin/%
@ mkdir -p $(dir $@)
fxconv -b $< -o $@ $(FXCONVFX) name:bin_$(basename $*) $(BIN.$*)
build-cg/assets/bin/%.o: assets-cg/bin/%
@ mkdir -p $(dir $@)
fxconv -b $< -o $@ $(FXCONVCG) name:bin_$(basename $*) $(BIN.$*)
#
# Cleaning and utilities
#
# Dependency information
-include $(shell find build* -name *.d 2> /dev/null)
build-fx/%.d: ;
build-cg/%.d: ;
.PRECIOUS: build-fx build-cg build-fx/%.d build-cg/%.d %/
clean-fx:
@ rm -rf build-fx/
clean-cg:
@ rm -rf build-cg/
distclean-fx: clean-fx
@ rm -f $(TARGET_FX)
distclean-cg: clean-cg
@ rm -f $(TARGET_CG)
clean: clean-fx clean-cg
distclean: distclean-fx distclean-cg
install-fx: $(TARGET_FX)
p7 send -f $<
install-cg: $(TARGET_CG)
@ while [[ ! -h /dev/Prizm1 ]]; do sleep 0.25; done
@ while ! mount /dev/Prizm1; do sleep 0.25; done
@ rm -f /mnt/prizm/$<
@ cp $< /mnt/prizm
@ umount /dev/Prizm1
@- eject /dev/Prizm1
.PHONY: all all-fx all-cg clean distclean install-fx install-cg

6
README.md Normal file → Executable file
View File

@ -12,12 +12,14 @@ Ceci est une adaptation utilisant Gint de Lephenixnoir pour avoir un jeu plus pl
## Éditer le jeu :
Clone ce dépot :
Clone ce dépot :
`$ git clone https://gitea.planet-casio.com/Tituya/AST3_C && cd AST3_C`
Pour ouvrir l'éditeur de niveau (Python et Pygame obligatoire).
`$ ./editor.sh`
Pour compiler le jeu (fxsdk + gint obligatoire).
`$ ./build.sh`
`$ fxsdk build-cg`
Appliquer le formatage au code après vos modifications.
`$ clang-format -style=file -i src/* include/*`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 945 B

After

Width:  |  Height:  |  Size: 256 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

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 192 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 217 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

After

Width:  |  Height:  |  Size: 349 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

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 220 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 308 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 250 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,77 @@
appear.png:
type:bopti-image
name: img_appear
blackout.png:
type:bopti-image
name: img_blackout
chock.png:
type:bopti-image
name: img_chock
chrono1.png:
type:bopti-image
name: img_chrono1
chrono2.png:
type:bopti-image
name: img_chrono2
coin.png:
type:bopti-image
name: img_coin
damaged.png:
type:bopti-image
name: img_damaged
dead.png:
type:bopti-image
name: img_dead
end.png:
type:bopti-image
name: img_end
endscreen.png:
type:bopti-image
profile:p4
name: img_endscreen
fxconv-metadata.txt:
type:bopti-image
name: img_metadata
ice.png:
type:bopti-image
name: img_ice
key1.png:
type:bopti-image
name: img_key1
key2.png:
type:bopti-image
name: img_key2
medals.png:
type:bopti-image
name: img_medals
menu.png:
type:bopti-image
profile:p4
name: img_menu
new.png:
type:bopti-image
profile:p4
name: img_new
player.png:
type:bopti-image
name: img_player
solid.png:
type:bopti-image
name: img_solid
speedrun.png:
type:bopti-image
profile:p4
name: img_speedrun
switch.png:
type:bopti-image
name: img_switch
nbswitch.png:
type:bopti-image
name: img_nbswitch
nbswitchlayout.png:
type:bopti-image
profile:p4
name: img_nbswitchlayout
rough.png:
type:bopti-image
name: img_rough

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 186 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 807 B

After

Width:  |  Height:  |  Size: 349 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 977 B

After

Width:  |  Height:  |  Size: 457 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 444 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 20 KiB

BIN
assets-cg/img/nbswitch.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

BIN
assets-cg/img/nbswitchlayout.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

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: 654 B

BIN
assets-cg/img/rough.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

BIN
assets-cg/img/solid.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 279 B

View File

@ -1,12 +0,0 @@
#!/usr/bin/bash
echo "making setlevel.c from editor"
rm src/setlevel.c
python3 compile_level.py
echo "done"
echo "making times.c from times.lvl"
rm src/times.c
python3 time.py
echo "done"
echo "building for cg"
fxsdk build-cg
echo "done"

17
compile_level.py → compile_levels.py Normal file → Executable file
View File

@ -1,17 +1,13 @@
ids = 0
save = open("src/setlevel.c","w+")
save = open("generated/setlevel.c","w+")
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){")
int *starty, char *gravity, int *appear, int *disappear, int *nbswitch){\nswitch(id_level){")
while 1:
try:
lv = open(f"editor/levels/{ids}.lvl","r")
ide = lv.readlines()
if len(ide)==1: save.write(f"case {ids}:\nmemcpy(level,\"{str(ide[0][:-1])}\",350);\nbreak;\n")
elif ide[1]!='\n':
save.write(f"case {ids}:\nmemcpy(level,\"{str(ide[0][:-2])}\",350);\n*appear={ide[1][:-1]};\n*disappear={ide[2]};\nbreak;\n")
else:
save.write(f"case {ids}:\nmemcpy(level,\"{str(ide[0][:-2])}\",350);\n*appear={ide[2][:-1]};\n*disappear={ide[3]};\nbreak;\n")
save.write(f"case {ids}:\nmemcpy(level,\"{str(ide[0][:-2])}\",350);\n*appear={ide[1][:-1]};\n*disappear={ide[2][:-1]};\n*nbswitch={ide[3]};\nbreak;\n")
ids+=1
except FileNotFoundError:
lv.close()
@ -33,16 +29,17 @@ y+=16;}i++;}}\n\
void set_gravity(int id_level, char *default_gravity){\n\
switch(id_level){")
ids = 0
gravity = 0
gravity = -1
while 1:
try:
lv = open(f"editor/levels/{ids}.lvl","r")
ide = lv.read()
if ide[350]=="6": gravity=0
else: gravity = 1
if ide[350]=="6": gravity=1
else: gravity = -1
save.write(f"case {ids}:\n*default_gravity = {gravity};\nbreak;\n")
ids+=1
except FileNotFoundError:
break
save.write("}}\nvoid del_level(char level[])\n{memcpy(level,\"\
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",350);}")

View File

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

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

@ -24,21 +24,17 @@ def newgrille():
["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"]
def load(ids):
global grille, gravityid, app, disa
global grille, gravityid, app, disa, nbswitchmax
try:
lv = open(f"editor/levels/{ids}.lvl","r")
ide = lv.readlines()
gravityid=str(ide[0][350:])
if len(ide)==1:
ide = str(ide[0][:-1])
else:
if ide[1]!="\n":
app = int(ide[1][:-1])
disa = int(ide[2])
else:
app = int(ide[2][:-1])
disa = int(ide[3])
ide = str(ide[0][:-2])
gravityid=(int)(ide[0][350:])
app = int(ide[1][:-1])
disa = int(ide[2])
nbswitchmax = int(ide[3])
ide = str(ide[0][:-2])
grille=[]
for j in range(14):
grille.append([])
@ -46,15 +42,16 @@ def load(ids):
grille[-1].append(str(ide[i+25*j]))
except FileNotFoundError:
newgrille()
gravityid="6"
gravityid=6
place()
def place():
level = font.render(str(id_level),1,(0,0,0))
if int(gravityid)==6: levelgr = font.render("",1,(120,0,0))
if int(gravityid)==7: levelgr = font.render("",1,(0,120,120))
if gravityid==6: levelgr = font.render("",1,(120,0,0))
if gravityid==7: levelgr = font.render("",1,(0,120,120))
timeapp = font.render("A="+str(app),1,(255,230,0))
timedisa = font.render("D="+str(disa)+" LOCK : "+str(lock),1,(255,180,0))
nbswitchfont = font.render("Nb="+str(nbswitchmax),1,(255,230,0))
for a in range(14):
for b in range(25):
pygame.draw.rect(fenetre,(255,255,255),((52*b, 52*a), (52, 52)))
@ -64,9 +61,9 @@ def place():
pygame.draw.rect(fenetre,(255,255,255),((52*b, 52*a), (52, 52)))
if grille[a][b]=="1":
fenetre.blit(pygame.transform.scale(solid_0,(52,52)),(52*b,52*a))
if grille[a][b]=="s" and int(gravityid)==6:
if grille[a][b]=="s" and gravityid==6:
fenetre.blit(pygame.transform.scale(player.subsurface((0,0),(12,12)),(39,39)),(52*b,52*a+13))
elif grille[a][b]=="s" and int(gravityid)==7:
elif grille[a][b]=="s" and gravityid==7:
fenetre.blit(pygame.transform.scale(player.subsurface((0,0),(12,12)),(39,39)),(52*b,52*a))
if grille[a][b]=="e":
fenetre.blit(pygame.transform.scale(end,(52,52)),(52*b,52*a))
@ -100,26 +97,28 @@ def place():
fenetre.blit(pygame.transform.scale(ice,(52,52)),(52*b,52*a))
if grille[a][b]=="S":
fenetre.blit(pygame.transform.scale(switch,(52,52)),(52*b,52*a))
if grille[a][b]=="p":
fenetre.blit(pygame.transform.scale(power,(52,52)),(52*b,52*a))
if grille[a][b]=="h" and tab==0:
fenetre.blit(pygame.transform.scale(appear,(52,52)),(52*b,52*a))
elif grille[a][b]=="h" and tab:
fenetre.blit(pygame.transform.scale(appearblock,(52,52)),(52*b,52*a))
if grille[a][b]=="z":
fenetre.blit(pygame.transform.scale(nbswitch,(52,52)),(52*b,52*a))
if grille[a][b]=="r":
fenetre.blit(pygame.transform.scale(rough,(52,52)),(52*b,52*a))
fenetre.blit(level, (10, 10))
fenetre.blit(levelgr, (10, 60))
fenetre.blit(timeapp, (55, 10))
fenetre.blit(timedisa, (140, 10))
if "z" in str(grille):
fenetre.blit(nbswitchfont, (370, 10))
if id_level==0 : fenetre.blit(font.render("NIVEAU DE TEST",1,(0,180,255)), (600,10))
pygame.display.flip()
def write():
global nbswitchmax
f = open(f"editor/levels/{id_level}.lvl","w+")
if not "c" in str(grille):
if not "m" in str(grille):
f.write(str(grille).replace("]","").replace("(","").replace(")","").replace("'","").replace("[","").replace(" ","").replace(",","")+f"{gravityid}")
else: f.write(str(grille).replace("]","").replace("(","").replace(")","").replace("'","").replace("[","").replace(" ","").replace(",","")+f"{gravityid}\n{app}\n{disa}")
else: f.write(str(grille).replace("]","").replace("(","").replace(")","").replace("'","").replace("[","").replace(" ","").replace(",","")+f"{gravityid}\n{app}\n{disa}")
if "z" not in str(grille): nbswitchmax = 1
f.write(str(grille).replace("]","").replace("(","").replace(")","").replace("'","").replace("[","").replace(" ","").replace(",","")+f"{gravityid}\n{app}\n{disa}\n{nbswitchmax}")
f.close()
pygame.init()
@ -129,14 +128,14 @@ fenetre = pygame.display.set_mode((25*52, 14*52))
font = pygame.font.SysFont('arial',25,True)
#Defini la suite des blocs pendant les changements (cliquer sur un 1 va donner un 2...)
suite=["0","1","d","s","e","k","3","K","a","c","m","t","l","b","B","i","S","h"]
suite=["0","1","d","s","e","k","3","K","a","c","m","t","l","b","B","i","S","h","z","r"]
lvm = open(f"include/define.h","r")
lvm = open(f"generated/include/define.h","r")
id_level = 0
id_level_max = int(''.join(list(filter(str.isdigit, lvm.readline()))))
gravityid = 6
disa = 10
app = 13
nbswitchmax = 1
lock=""
tab = 0
@ -160,6 +159,8 @@ switch = pygame.image.load("editor/img/switch.png").convert_alpha()
ice = pygame.image.load("editor/img/ice.png").convert_alpha()
appear = pygame.image.load("editor/img/appear.png").convert_alpha()
appearblock = pygame.image.load("editor/img/appearblock.png").convert_alpha()
nbswitch = pygame.image.load("editor/img/nbswitch.png").convert_alpha()
rough = pygame.image.load("editor/img/rough.png").convert_alpha()
load(id_level)
place()
@ -172,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":
@ -195,6 +196,14 @@ while securite==False:
disa-=1
write()
place()
if carac == "t" and "z" in str(grille):
nbswitchmax+=1
write()
place()
if carac == "g" and "z" in str(grille):
if nbswitchmax > 0: nbswitchmax-=1
write()
place()
if carac == "a":
lock=""
place()
@ -203,16 +212,16 @@ while securite==False:
write()
place()
if event.key == pygame.K_LSHIFT:
if gravityid=="7":
gravityid="6"
if gravityid==7:
gravityid=6
else:
gravityid="7"
gravityid=7
write()
place()
if event.key == pygame.K_TAB:
if tab==0: tab = 1
else: tab = 0
place()
if tab==0: tab = 1
else: tab = 0
place()
elif event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
x=int(event.pos[0]/52)
@ -240,17 +249,7 @@ while securite==False:
if event.button == 3:
x=int(event.pos[0]/52)
y=int(event.pos[1]/52)
if lock!="":
grille[y][x]="0"
else:
for i in range(len(suite)):
if grille[y][x] == suite[i]:
if i!=len(suite)+1:
grille[y][x]=suite[i-1]
break
else:
grille[y][x]=suite[len(suite)]
break
grille[y][x]="0"
pygame.draw.rect(fenetre,(255,255,255),((52*x, 52*y), (55, 55)))
place()
write()
write()

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

@ -13,17 +13,18 @@ Pour ouvrir (python3 + pygame):
- S baisser temps avant apparition blocs +
- R augmenter temps avant disparition blocs - (temps affiché en haut à gauche)
- F baisser temps avant disparition blocs -
- T augmenter le nombre de switch possibles dans le niveau (nécessite le bloc d'activation)
- G baisser le nombre de switch possibles dans le niveau
- SHIFT changer le sens de la gravité par défaut (gravité affichée en haut à gauche)
- TAB Afficher le design des blocs non activé
- A supprime le bloc bloqué dans la main.
- N pour reset la pièce en entier
Click gauche : tourner parmis les blocs dans le sens horaire
Click droit : tourner parmis les blocs dans le sens anti-horaire
Click gauche : tourner parmis les blocs
Click droit : supprimer le bloc
Click molette centrale sur un bloc : bloquer ce bloc dans la main, permet de placer plusieurs fois le même bloc rapidement. (bloc bloqué affiché en haut)
Click gauche après molette : placer le bloc
Click droit après molette : supprimer le bloc
## Sauvegarde :
@ -31,4 +32,4 @@ L'éditeur sauvegarde automatiquement les niveaux à chaques actions.
`$ ./build.sh` pour construire l'application depuis ces niveaux.
by Tituya
Tituya

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 148 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

After

Width:  |  Height:  |  Size: 161 B

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

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 192 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 217 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 237 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

After

Width:  |  Height:  |  Size: 171 B

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

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 226 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 308 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 247 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 186 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 B

After

Width:  |  Height:  |  Size: 214 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 216 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 221 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 166 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 590 B

After

Width:  |  Height:  |  Size: 219 B

BIN
editor/img/nbswitch.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 644 B

BIN
editor/img/rough.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 B

After

Width:  |  Height:  |  Size: 99 B

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

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

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

@ -1,4 +1,4 @@
111111111111111111111111100000000c300000000000100000000000c3000000K0k0l1000111ddd1111aaa111111111h11111ddd1111aaa1ddddd00000110000001110001d000000000110s00001110001d000000000111111001110001d0011d1100110b01001110001d00e000000110S01001110001d000000000110001001110001d011111000100t01000m00001d000000000000001000m00001ddddd00000011111111111111111111111116
111111rrrrriiiiiii11000111000000000000000000000001100000000000000000000000110e0000b00z000l00S000000111111aaaaaaa11111111111111ddd1ddddddd1mmm1000000011ddd111111111mmm1000000011ddd111111111ccc101BB00011ddd1ddddddd1ccc10i00000111111aaaaaaa111110i000001100000000000030010i0000011000000000000300h0i1BBB111s000K00000k0300h0i0000011111111ddd1111111111000116
6
9
13
20

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

@ -1 +1,4 @@
10011111111dddd1111111111000111100000000000000000000011110011111111ddd100001111111001dd000ddddd111111111111001dd0t0ddddddddd11000001001dd000ddddddddd11000001001aaaaaaaaaaaaaa110s00010010000000000000e11d1100100100000000000aaa11111001001000000000ddddd1111100100100000000011111100010000010000000003000000001000001000K0000030k00010011111111111111111111116
10011111111dddd1111111111000111100000000000000000000011110011111111ddd100001111111001dd000ddddd111111111111001dd0t0ddddddddd11000001001dd000ddddddddd11000001001aaaaaaaaaaaaaa110s00010010000000000000e11d1100100100000000000aaa11111001001000000000ddddd1111100100100000000011111100010000010000000003000000001000001000K0000030k00010011111111111111111111116
11
10
1

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

@ -1 +1,4 @@
11111111t133111111100011111111111133311111110K01111100000100111111111000111110s00010i11111100000001111d110K10i11111d000000011111110K10i1111a001BBBBB11110000010i111d0a010000011110000010i11a03011d0ddd1111001ddd0i1d0a0d110000011110000000i0a30111100e00111100000k0130ad11110aa001111dd000001031111111ddd11111111111B1001111111aaa11111111111010011111110001116
dddddddddddddddddddddddddBBBBBBBBBBBBBBBBBBBBBBBBB100001kk10011111dt0a000011000010010010000d11a00001100001BB100100000000000013000000000010001110000000300000000001aaaaaa0000000111111000001000000001111110dd00000001000000001000110000000a001BBBd00a0100013000000000010001000010003300s000000010K0100001e003aaBBBBBBBBBBBBBBBBBBBaaaaddddddddddddddddddddddddd6
13
10
1

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

@ -1 +1,4 @@
1ddddddddddd11dddddddddd11dddddddddd00000dd3aaa11i1dd111100000000000030000i1dd000000000001110003000i1d000001111100K000003000i1d00000S00k0000000003aBB110s000100000ddd011103atl11111331ddddddddddddddd1111ddd001dddddddd11d0S0ddd11ddd00d1dd11d000300000dd11ddd000000000000300000dd11dddaaa00000000d3S00e0dd11dddddd00S0d111d3d000ddd11ddddddddddddddddddddddd16
00000ddddddd100000000000011111111111111111110011111000000dd1111ddd0K10000b1100111000000100000100000110000100000010000010010011000k111dd101dd00d10000011000110000001000001BBBB011000100011dd1000001dddd01100010ddd1dd1d00dd1011001133310ddd1dd1BBBBB1t00001100000ddd1dd1000001ddd1111s0000ddd1dd10000011111111BBB111aaaaa110001111111100000000000e10000000000006
13
10
1

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

@ -1 +1,4 @@
1111111111010001dd11111110000001000013331001000000000000100t01000h0010000001111iB111111000h0013311111e00ik11d111000300300000d10ddi011d0010003003000s0d10aai01000010001hh1hh11111000i01h1h1100010010000011dd0i000000h00010010001a11aa01dd0dd110001001000h0110001dd1d1110S0100100010110000S0S0001ddd100h0001Kd100000S0S001111100h00011111111dddd10h00011111111116
1111111111111ddd11iK1d00100000d111000000011it1d00000000d100000000011i31110011100d13331110e011ihhh11100000d100011111111i00000000000d100000011111i00111011100d1000000000011000s111111111000000000011dd0001hk001111i00Sddd001dddd00hh0000001i000111000aad1ddhddd0000000001110000001111111dd0000000111000000001111111dd000011110000000001111111111111111ddd13100017
13
10
1

View File

@ -1 +1,4 @@
11111111111111111111111111ddddddddd0S00ddddddddddd1ddddaaaaa000000ddddddddd1ddd00S000000e0ddd0dddddd1dd000000ddddddd00000dddd1daaaa00dd11100S00S000ddd10000000d00000000000S00dd10K000h0d00001100000000dd1111000ddd000000S0d0h00dd1ddd000dd000dd000ddd000dd1dddhhdd000ddddddddd000dd1ddb00S0000100000dd0000dd1dtb00000011s000000000ddd111111d11111111111111dddd6
1333111111111111iiii11111i000d1iii1iiii000000d0001i0000iiii1iiii000000d0e0ii000000001iii1000000d000ii000000001iid1aaa0000000ii00S000000000000a000S000i1t000K00000S0000i1rr1iid111iiii1ii1rrr1iiid000000i10k00000000000000000i000i10000000000000000000i000i1333rrii11iiiirriii11000i100000000000000000000000i10s0000000000000000000S011333iiirriirriii111iiii116
8
10
1

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

@ -1 +1,4 @@
1111111111111ddd11iK1d00100000d111000000011it1d00000000d100000000011i31110011100d13331110e011ihhh11100000d100011111111i00000000000d100000011111i00111011100d1000000000011000s111111111000000000011dd0001hk001111i00Sddd001dddd00hh0000001i000111000aad1ddhddd0000000001110000001111111dd0000000111000000001111111dd000011110000000001111111111111111ddd13100017
1111111111010001dd11111110000001000013331001000000000000100t01000h0010000001111iB111111000h0013311111e00ik11d111000300300000d10ddi011d0010003003000s0d10aai01000010001hh1hh11111000i01h1h1100010010000011dd0i000000h00010010001a11aa01dd0dd110001001000h0110001dd1d1110S0100100010110000S0S0001ddd100h0001Kd100000S0S001111100h00011111111dddd10h00011111111116
13
10
1

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

@ -1,4 +1,4 @@
i011100dd1111dddm111ddmd1i01d1000000010S0011100S01i01d100000001000000000001i01d1cc111001hh1c11111001i01ddddddi00i000bddd00001i01dd1133i00i000lddd000K1100000000i00i00001d110011300000000i00100331d100003300000010i001s03t1d1000031111100hki0011111ddd1BB1110S01hh11100m0000aaa0000110001001d100m000000000001100e1001d100m0aaa000aaa0110d11001111111ddddddddd116
4
7
11111111111111111111111111ddddddddd0S00ddddddddddd1ddddaaaaa000000ddddddddd1ddd00S000000e0ddd0dddddd1dd000000ddddddd00000dddd1daaaa00dd11100S00S000ddd10000000d00000000000S00dd10K000h0d00001100000000dd1111000ddd000000S0d0h00dd1ddd000dd000dd000ddd000dd1dddhhdd000ddddddddd000dd1ddb00S0000100000dd0000dd1dtb00000011s000000000ddd111111d11111111111111dddd6
13
10
1

4
editor/levels/16.lvl Executable file
View File

@ -0,0 +1,4 @@
11111111t133111111100011111111111133311111110K01111100000100111111111000111110s00010i11111100000001111d11zz10i11111d000000011111110010i1111a001BBBBB11110000010i111d0a010000011110000010i11a03011d0ddd1111001ddd0i1d0a0d110000011110000000i0a30111100e001111K0000k0130ad11110aa001111d0000001031111111ddd11111111111B1001111111aaa11111111111010011111110001116
13
10
10

4
editor/levels/17.lvl Normal file
View File

@ -0,0 +1,4 @@
101111110111111111100111110dS00d00000001111100111110aaa0d00000K010000001111100h00d0S0000010ddaaa1111100000ddd1111110ddddd1111111a00000S1e3s00100S0111100z0000000111dda100k0100000z000000000ddddd00001000111ddaaaaa000000000101001100Saddddd0000000001010011000000aa11111111111110011000a000003000000010000011000a0a0003010000t100000110111111011111111110011117
13
10
19

4
editor/levels/18.lvl Executable file
View File

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

4
editor/levels/19.lvl Executable file
View File

@ -0,0 +1,4 @@
11111dddd100d110111111331000000000000d1d0000dd10s0111d00000000K1d10000d11111ddddd11ddhh1dddd000dddd11100Sh00dd00000dd00000001i0000000dd000000d0000S001i01100d0dd00d000dd0000001i0d00Sd0dd00dd10ddhh00l01i0ddddd0dd00ddi0d00000001iBBBdd0011aaddi0d0S00d0011000dd000300ddi0d0000d00110mmdd000d00ddi0dd00dd0011emtdddddd00ddi0ddddddkk1111111111100111Bdddd110016
14
10
1

View File

@ -1,3 +1,4 @@
1dddddd100111111111111111000000000011111000000000000000000l01100c00000000001aaaaaaa111100c00000000011dddddddddd1001aaaaaaaaa11cccccccccc1001ddddddddd1000000000001331000000aa000000000000s10e1k0000000001ccccccccc111111111113311100000000011001000000000110000000001100b0000000001100000000011t0b00000000011000K0000011111aaaaaaaaa1111111110011111ddddddddd16
12
1111d1d1111111111111111111e01010111100000s01d000d1100001011110001ddd1d000d11d00000111100011111d0k0d11d0d0000001000000000000011d0d0d0000100000000000001111ddd11001000000t0000001100000000011111dd1dd1133110000000001000aaad1111001100111dd111000000d000000110000000003000d00d000000110000000003000d00000d00011000d000003000d00K00d000111111111111111111111111117
8
10
1

4
editor/levels/20.lvl Normal file
View File

@ -0,0 +1,4 @@
111111110011ddd111111111110000001000S000S0d000000110000001000000000d0000s0111mmm101aaa000000d00BBB31100m01010a0000000d00B0Bb1100m01h10a00dKdhi0i0BBB011d0m01h10a00d0d00i00B0B011d0001h10000dSd00i00d00011d00d1h10000ddd00iBBd0t01h000d101dddd11100000d000h1000d1011111111331111111130000100000ddd000000100003000110000000000000k10e00111111110011111ddd11111116
8
10
1

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

@ -1 +1,4 @@
11001111111001111111111111000111dddd000000000100013000111dddd00000000010003300000000dd11111000010e03100000000dd03a01000011111111110000dd03a01000000001100s1dd00ddt3a0100000000110001dd00dd1110100000000110001dd0Kdd00001ddd000ddd10001dd00dd00001111100ddd10001dd00dd00001000000ddd30001dd0000000010k000000330001dd0000000010000000031d001111111001111111111117
1dddddd1001111111111111110000000000111110000000000000000l0001100c00000000001aaaaaaa111100c00000000011dddddddddd1001aaaaaaaaa11cccccccccc1001ddddddddd1000000000001331000000aa000000000000s10e1k0000000001ccccccccc111111111113311100000000011001000000000110000000001100b0000000001100000000011t0b00000000011000K0000011111aaaaaaaaa1111111110011111ddddddddd16
13
2
1

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

@ -1,3 +1,4 @@
11111111111011111dddd1111100001dd0000dd100000000011s0001dd0d11dd10000000001111001dd0d111dd00111100011dd001dt0d10000001dd100011dd001d11d10000001dd100011dd00dd11110011111dd100011dd00000000001dddddd100011dd1111dbd1111ddd111100011ddddddd0dd1d1ddd100000011ddddddd0000d1ddd1e0000011ddddddd1110d1ddd111cccc11dddddddddd0d1ddd111dddd111111111111011111111111116
12
13
13
7
1

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

@ -1,3 +1,4 @@
000000000000000000000000000000000000000000000000t000000000000000000000000000011dd111111111111111110000100000100000010000001000011cc001s0000d00000001000010000e111dd0100000dd100001001111000d0000000dd100001000001000111d000ddd1000010000000000000000ddd1000011111111111d111B11111000000000000000000000000000000000000000000000000000000000000000000000000000006
12
6
11001111111001111111111111000111dddd000000000100013000111dddd00000000010003300000000dd11111000010e03100000000dd03a01000011111111110000dd03a01000000001100s1dd00ddt3a0100000000110001dd00dd1110100000000110001dd0Kdd00001ddd000ddd10001dd00dd00001111100ddd10001dd00dd00001000000ddd30001dd0000000010k000000330001dd0000000010000000031d001111111001111111111117
13
10
1

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

@ -1,3 +1,4 @@
10001011111011111111111111000101dd10001111dddd11110000101dd10001000000000001111101dd1aaa1000ccccddd110s00010013331000000000011dddd110010001mmmdd00000100000000010e010t0dd00000011111100011111d1dddddd1111k00000001d000111001111111111111101d00000000000111000010000100000000000000010K010000100011100000011110001000010001110000dd11110001011111011111111111117
5
9
000000000000000000000000000000000000000000000000t000000000000000000000000000011dd111111111111111110000100000100000010000001000011cc001s0000d00000001000010000e111dd0100000dd100001001111000d0000000dd100001000001000111d000ddd1000010000000000000000ddd1000011111111111d111B11111000000000000000000000000000000000000000000000000000000000000000000000000000006
13
6
1

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

@ -1 +1,4 @@
111001111111100i0d0011111100000111ddd000i0d0000001100000000000000itd00000e1111111ddd111111111111111100000000000000000h00d0000111111111dd111110100d000110001100000000010100d0001000011000000000i0d00d0000000000000000000i0d00d00001111dd111000000ild00111111000011111ddd00i0d0011111d000011111ddd00i0d0011111d0s0011111ddd00i0d0011111111001111111100i0d00111116
111001111111100i0d0011111100000111ddd000i0d0000001100000000000000itd00000e1111111ddd111111111111111100000000000000000h00d0000111111111dd111110100d000110001100000000010100d0001000011000000000i0d00d0000000000000000000i0d00d00001111dd111100000ild00111111000011111ddd00i0d0011111d000011111ddd00i0d0011111d0s0011111ddd00i0d0011111111001111111100i0d00111116
13
10
1

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

@ -1 +1,4 @@
dddddddddddddddddddddddddBBBBBBBBBBBBBBBBBBBBBBBBB100001kk10011111dt0a000011000010010010000d11a00001100001BB100100000000000013000000000010001110000000300000000001aaaaaa0000000111111000001000000001111110dd00000001000000001000110000000a001BBBd00a0100013000000000010001000010003300s000000010K0100001e003aaBBBBBBBBBBBBBBBBBBBaaaaddddddddddddddddddddddddd6
1ddddddddddd11dddddddddd11dddddddddd00000dd3aaa11i1dd111100000000000030000i1dd000000000001110003000i1d000001111100K000003000i1d00000S00k0000000003aBB110s000100000ddd011103atl11111331ddddddddddddddd1111ddd001dddddddd11d0S0ddd11ddd00d1dd11d000300000dd11ddd000000000000300000dd11dddaaa00000000d3S00e0dd11dddddd00S0d111d3d000ddd11ddddddddddddddddddddddd16
13
10
1

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

@ -1 +1,4 @@
00000ddddddd100000000000011111111111111111110011111000000dd1111ddd0K10000b1100111000000100000100000110000100000010000010010011000k111dd101dd00d10000011000110000001000001BBBB011000100011dd1000001dddd01100010ddd1dd1d00dd1011001133310ddd1dd1BBBBB1t00001100000ddd1dd1000001ddd1111s0000ddd1dd10000011111111BBB111aaaaa110001111111100000000000e10000000000006
10001011111011111111111111000101dd10001111dddd11110000101dd10001000000000001111101dd1aaa1000ccccddd110s00010013331000000000011dddd110010001mmmdd00000100000000010e010t0dd00000011111100011111d1dddddd1111k00000001d000111001111111111111001d00000000000111000010000100000000000000010K010000100011100000011110001000010001110000dd11110001011111011111111111117
5
9
1

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

@ -1,6 +1,11 @@
#pragma once
char collide(int x, int y, char level[], char block);
char collide_gravity(int x, int y, char level[], char gravity, char block);
char collide_solid_gravity(int x, int y, char level[], char gravity);
char collide_solid(int x, int y, char level[]);
char collide_dead(int x, int y, char level[]);
char collide_point(int x, int y, char level[], char block);
char collide_end(int x, int y, char level[]);
void collide_replace(int x, int y, char level[], char collide, char replace);
char collide_center(int x, int y, char level[], char block);

View File

@ -1,3 +0,0 @@
#define LEVEL_MAX 15
#define PLAYER_HEIGHT 11
#define FPS 70

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

@ -1,5 +1,8 @@
#pragma once
void draw_level(char level[]);
void draw_player(int x, int y, char type);
void draw_timer(unsigned int frame);
void draw_blackout(int x, int y);
void draw_end(int framelevel, int id_level, char record);
void draw_nbswitch(int nbswitch);

11
include/friction.h Normal file
View File

@ -0,0 +1,11 @@
#pragma once
#define MAX_HSPD 2.0
#define HFRICTION 0.2
#define HACCELERATION (MAX_HSPD * HFRICTION)
void mod_accel_and_fric(float *acceleration, float *friction, int x, int y,
char level[]);
int mod_ice(float *acceleration, float *friction, int x, int y, char level[]);
int mod_rough(float *acceleration, float *friction, int x, int y, char level[]);
int mod_solid(float *acceleration, float *friction, int x, int y, char level[]);

View File

@ -1,3 +1,9 @@
char start_menu();
char speed_menu(int *id_level);
int round(float num);
#pragma once
enum MenuCode { MenuLevelSel, MenuAllMode, MenuTutorial, MenuExit };
enum MenuPause { MenuContinue, MenuBack };
enum MenuCode start_menu();
char level_selection(int *id_level);
enum MenuPause pause_menu(char level[], int id_level, int coin,
int death_count);

4
include/replace.h Normal file
View File

@ -0,0 +1,4 @@
#pragma once
void replace_all_block(char a, char b, char level[]);
void replace_xy_block(int x, int y, char block, char level[]);

View File

@ -1,6 +1,6 @@
void savefile(void);
int loadtime(int a);
void loadfile(void);
void restore(void);
void savetimes(float framelevel, int id_level);
#pragma once
void savefile(void);
int loadtime(int idlevel);
void restore(void);
void savetime(float framelevel, int id_level);

View File

@ -1,3 +1,6 @@
void set_level(int id_level, char level[], int *startx, int *starty, char *gravity, int *appear, int *disappear);
#pragma once
void set_level(int id_level, char level[], int *startx, int *starty,
char *gravity, int *appear, int *disappear, int *nbswitch);
void set_gravity(int id_level, char *default_gravity);
void del_level(char level[]);

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

@ -1,2 +1,4 @@
#pragma once
void check_medal(unsigned int frame_level, int id_level, int x, int y);
void draw_time(int id_level);

6
include/util.h Normal file
View File

@ -0,0 +1,6 @@
#pragma once
int round(float num);
int round_sup(float num);
int rand_range(int low, int high);
int sign(float x);

View File

@ -1,90 +0,0 @@
#---
# fxSDK project configuration file for cube
#---
# Project name, should be at most 8 bytes long.
# (You can also specify NAME_G1A or NAME_G3A to override individually.)
NAME := AST3
# Internal name, should be '@' followed by at most 7 uppercase letters.
# WARNING: If this convention is not followed, the add-in might not appear in
# the main menu of the calculator!
INTERNAL := ASTTT
# Output file name. The default is to take <NAME>, replace spaces with dashes,
# and add .g1a (or .g3a). You can specify a different folder if you want.
TARGET_FX :=
TARGET_CG :=
# fx-9860G icon location
ICON_FX = assets-fx/icon-fx.png
# fx-CG 50 icon locations
ICON_CG_UNS = assets-cg/icon-cg-uns.png
ICON_CG_SEL = assets-cg/icon-cg-sel.png
#---
# Toolchain selection
#---
# Toolchain for fx9860g. Please see also CFLAGS_FX below.
TOOLCHAIN_FX := sh-elf
# Toolchain for fxcg50. Please see also CFLAGS_CG below.
TOOLCHAIN_CG := sh-elf
#---
# Compiler flags
#---
# Base compiler flags for the fxSDK, you usually want to keep these.
CFLAGS := -mb -ffreestanding -nostdlib -fstrict-volatile-bitfields
# Platform-specific compiler flags.
# <> If you are using sh3eb-elf, use -m3. (You can do this on both FX and CG.)
# <> If you are using sh4eb-elf, use -m4-nofpu. (Not ideal on FX but works.)
# <> If you are using sh4eb-nofpu-elf, then your compiler will likely use the
# FPU and cause problems on the calculator. Consider another configuration.
# <> If you are using an sh-elf with several targets, specify whichever you
# support. I recommend -m3 on FX and -m4-nofpu on CG.
# Please see also TOOLCHAIN_FX and TOOLCHAIN_CG above.
CFLAGS_FX := -D FX9860G -m3
CFLAGS_CG := -D FXCG50 -m4-nofpu
# Additional compiler flags, change to your own taste!
CFLAGS += -Wall -Wextra -Os
# Include paths. Add one -I option for each folder from which you want to
# be able to include files with #include<>.
INCLUDE := -I include
# Libraries. Add one -l option for each library you are using, and also
# suitable -L options if you have library files in custom folders. To use
# fxlib, add libfx.a to the project directory and use "-L . -lfx".
LIBS_FX :=
LIBS_CG :=
# Base linker flags for the fxSDK, you usually want to keep these.
LDFLAGS_FX := -T fx9860g.ld -lgint-fx $(LIBS_FX) -lgint-fx -lgcc
LDFLAGS_CG := -T fxcg50.ld -lgint-cg $(LIBS_CG) -lgint-cg -lgcc
# Additional linker flags, if you need any.
LDFLAGS :=
# Additional platform-specific linker flags.
LDFLAGS_FX += -Wl,-Map=build-fx/map
LDFLAGS_CG += -Wl,-Map=build-cg/map
#---
# File conversion parameters
#---
# Here you can add fxconv options for each converted file, individually.
# The syntax is "<type>.<file>". For example, to specify the parameters for a
# font named "hexa.png", you might write:
#
# FONT.hexa.png = charset:print grid.size:3x5 grid.padding:1
IMG.speedrun.png = profile:p4
IMG.menu.png = profile:p4
IMG.endscreen.png = profile:p4
IMG.new.png = profile:p4

View File

@ -1,44 +1,72 @@
#include "collide.h"
#include "define.h"
#include "util.h"
#define DEAD_COLLISION 3 //make the collision with the deadly block less effective
#define DEAD_COLLISION 3 // make collision with the deadly block less effective
char collide(int x, int y, char level[], char block) //detect if player is in a block
char collide(int x, int y, char level[],
char block) // detect if player is in a block
{
if((level[(int)(x/16) + (int)((y + PLAYER_HEIGHT)/16) * 25] == block ||
level[(int)((x + PLAYER_HEIGHT)/16) + (int)((y + PLAYER_HEIGHT)/16) * 25] == block ||
level[(int)(x/16) + (int)((y/16) * 25)] == block ||
level[(int)((x + PLAYER_HEIGHT)/16) + (int)((y/16) * 25)] == block)) return 1;
if(collide_point(x, y, level, block) ||
collide_point(x + PLAYER_HEIGHT, y, level, block) ||
collide_point(x, y + PLAYER_HEIGHT, level, block) ||
collide_point(x + PLAYER_HEIGHT, y + PLAYER_HEIGHT, level, block))
return 1;
return 0;
}
char collide_gravity(int x, int y, char level[], char gravity, char block) {
if(gravity == 1) {
if(collide_point(x, y + PLAYER_HEIGHT, level, block) ||
collide_point(x + PLAYER_HEIGHT, y + PLAYER_HEIGHT, level, block))
return 1;
} else {
if(collide_point(x, y, level, block) ||
collide_point(x + PLAYER_HEIGHT, y, level, block))
return 1;
}
return 0;
}
char collide_solid(int x, int y, char level[])
{
return collide(x, y, level, '1')
|| collide(x, y, level, '3')
|| collide(x, y, level, '4')
|| collide(x, y, level, 'c')
|| collide(x, y, level, 'C')
|| collide(x, y, level, 'B')
|| collide(x, y, level, 'i')
|| collide(x, y, level, 'H');
return collide(x, y, level, '1') || collide(x, y, level, '3') ||
collide(x, y, level, '4') || collide(x, y, level, 'c') ||
collide(x, y, level, 'C') || collide(x, y, level, 'B') ||
collide(x, y, level, 'i') || collide(x, y, level, 'H') ||
collide(x, y, level, 'r');
}
char collide_solid_gravity(int x, int y, char level[], char gravity)
{
return collide_gravity(x, y, level, gravity, '1') || collide_gravity(x, y, level, gravity, '3') ||
collide_gravity(x, y, level, gravity, '4') || collide_gravity(x, y, level, gravity, 'c') ||
collide_gravity(x, y, level, gravity, 'C') || collide_gravity(x, y, level, gravity, 'B') ||
collide_gravity(x, y, level, gravity, 'i') || collide_gravity(x, y, level, gravity, 'H') ||
collide_gravity(x, y, level, gravity, 'r');
}
char collide_dead(int x, int y, char level[])
{
return collide_point(x + DEAD_COLLISION, y + DEAD_COLLISION, level, 'd') ||
collide_point(x + PLAYER_HEIGHT - DEAD_COLLISION, y + DEAD_COLLISION, level, 'd') ||
collide_point(x + DEAD_COLLISION, y + PLAYER_HEIGHT - DEAD_COLLISION, level, 'd') ||
collide_point(x + PLAYER_HEIGHT - DEAD_COLLISION, y + PLAYER_HEIGHT - DEAD_COLLISION, level, 'd') ||
collide_point(x + 1, y + 1, level, 'C') ||
collide_point(x + PLAYER_HEIGHT - 1, y + 1, level, 'C') ||
collide_point(x + 1, y + PLAYER_HEIGHT - 1, level, 'C') ||
collide_point(x + PLAYER_HEIGHT - 1, y + PLAYER_HEIGHT - 1, level, 'C');
return collide_point(x + DEAD_COLLISION, y + DEAD_COLLISION, level,
'd') ||
collide_point(x + PLAYER_HEIGHT - DEAD_COLLISION,
y + DEAD_COLLISION, level, 'd') ||
collide_point(x + DEAD_COLLISION,
y + PLAYER_HEIGHT - DEAD_COLLISION, level, 'd') ||
collide_point(x + PLAYER_HEIGHT - DEAD_COLLISION,
y + PLAYER_HEIGHT - DEAD_COLLISION, level, 'd') ||
collide_point(x + 1, y + 1, level, 'C') ||
collide_point(x + PLAYER_HEIGHT - 1, y + 1, level, 'C') ||
collide_point(x + 1, y + PLAYER_HEIGHT - 1, level, 'C') ||
collide_point(x + PLAYER_HEIGHT - 1, y + PLAYER_HEIGHT - 1,
level, 'C');
}
char collide_point(int x, int y, char level[], char block)
{
return (level[(int)(x/16) + (int)(y/16) * 25] == block);
return (level[(int)(x / TILE_HEIGHT) +
(int)(y / TILE_HEIGHT) * LEVEL_WIDTH] == block);
}
char collide_end(int x, int y, char level[])
@ -48,20 +76,33 @@ char collide_end(int x, int y, char level[])
void collide_replace(int x, int y, char level[], char collide, char replace)
{
if(collide_point(x, y, level, collide))
{
level[((x)/16)+((y)/16)*25] = replace;
if (collide_point(x, y, level, collide)) {
level[((x) / TILE_HEIGHT) + ((y) / TILE_HEIGHT) * LEVEL_WIDTH] =
replace;
}
if(collide_point(x + PLAYER_HEIGHT, y, level, collide))
{
level[((x + PLAYER_HEIGHT)/16)+((y)/16)*25] = replace;
if (collide_point(x + PLAYER_HEIGHT, y, level, collide)) {
level[((x + PLAYER_HEIGHT) / TILE_HEIGHT) +
((y) / TILE_HEIGHT) * LEVEL_WIDTH] = replace;
}
if(collide_point(x, y + PLAYER_HEIGHT, level, collide))
{
level[((x)/16)+((y + PLAYER_HEIGHT)/16)*25] = replace;
if (collide_point(x, y + PLAYER_HEIGHT, level, collide)) {
level[((x) / TILE_HEIGHT) +
((y + PLAYER_HEIGHT) / TILE_HEIGHT) * LEVEL_WIDTH] =
replace;
}
if(collide_point(x + PLAYER_HEIGHT, y + PLAYER_HEIGHT, level, collide))
{
level[((x + PLAYER_HEIGHT)/16)+((y + PLAYER_HEIGHT)/16)*25] = replace;
if (collide_point(x + PLAYER_HEIGHT, y + PLAYER_HEIGHT, level,
collide)) {
level[((x + PLAYER_HEIGHT) / TILE_HEIGHT) +
((y + PLAYER_HEIGHT) / TILE_HEIGHT) * LEVEL_WIDTH] =
replace;
}
}
char collide_center(int x, int y, char level[], char block)
{
if (level[(int)((x + round_sup(PLAYER_HEIGHT / 2)) / TILE_HEIGHT) +
(int)((y + round_sup(PLAYER_HEIGHT / 2)) / TILE_HEIGHT) *
LEVEL_WIDTH] == block) {
return 1;
}
return 0;
}

40
src/draw_time.c Normal file
View File

@ -0,0 +1,40 @@
#include "define.h"
#include "times.h"
#include <gint/display.h>
extern bopti_image_t img_medals;
extern float level_time[];
static const float medal_multiplier[4] = {1.0, 1.2, 1.5, 2};
void check_medal(unsigned int frame_level, int id_level, int x, int y)
{
const float time = level_time[id_level - 1];
const int player_time = (int)((float)frame_level / FPS * 100.0);
int i;
i = 4;
while (i-- > 0) {
const int mtime = (int)(time * medal_multiplier[i] * 100.0);
if (player_time <= mtime) {
dsubimage(x + 15 * (3 - i), y, &img_medals,
12 * (3 - i), 0, 12, 12, DIMAGE_NONE);
}
}
}
void draw_time(int id_level)
{
const float time = level_time[id_level - 1];
int i;
i = 4;
while (i-- > 0) {
const int draw_y = 140 + 20 * i;
dsubimage(340, draw_y, &img_medals, 12 * (3 - i), 0, 12, 12,
DIMAGE_NONE);
dprint(355, draw_y + 1, C_BLACK, "%.2j",
(int)(time * medal_multiplier[i] * 100));
}
}

View File

@ -1,33 +1,36 @@
#include "drawlevel.h"
#include <gint/std/string.h>
#include <gint/display.h>
#include "define.h"
#include "times.h"
#include <gint/display.h>
#include <gint/std/string.h>
#define VISIBLE_RECT 35
extern bopti_image_t img_solid_0; //solid block
extern bopti_image_t img_coin; //facultative coin
extern bopti_image_t img_dead; //dead block
extern bopti_image_t img_player; //player
extern bopti_image_t img_end; //end of level
extern bopti_image_t img_key1; //key 1
extern bopti_image_t img_blackout; //blackout
extern bopti_image_t img_chrono1; //chronoblock
extern bopti_image_t img_chrono2; //chronoblock 2
extern bopti_image_t img_key2; //key 2
extern bopti_image_t img_damaged; //damaged block
extern bopti_image_t img_chock; //chock block
extern bopti_image_t img_switch; //switch block
extern bopti_image_t img_ice; //switch block
extern bopti_image_t img_appear; //appear block
extern bopti_image_t img_solid; // solid block
extern bopti_image_t img_coin; // facultative coin
extern bopti_image_t img_dead; // dead block
extern bopti_image_t img_player; // player
extern bopti_image_t img_end; // end of level
extern bopti_image_t img_key1; // key 1
extern bopti_image_t img_blackout; // blackout
extern bopti_image_t img_chrono1; // chronoblock
extern bopti_image_t img_chrono2; // chronoblock 2
extern bopti_image_t img_key2; // key 2
extern bopti_image_t img_damaged; // damaged block
extern bopti_image_t img_chock; // chock block
extern bopti_image_t img_switch; // switch block
extern bopti_image_t img_ice; // ice block
extern bopti_image_t img_appear; // appear block
extern bopti_image_t img_nbswitch; // nbswitch block
extern bopti_image_t img_rough; // rough block
extern bopti_image_t img_endscreen;
extern bopti_image_t img_nbswitchlayout;
extern bopti_image_t img_new;
void draw_player(int x, int y, char type)
{
dsubimage(x,y,&img_player, 12*(type-1),0,12,12, DIMAGE_NONE);
dsubimage(x, y, &img_player, 12 * (type - 1), 0, 12, 12, DIMAGE_NONE);
}
void draw_level(char level[])
@ -36,76 +39,82 @@ void draw_level(char level[])
unsigned int x = 0;
unsigned int y = 0;
unsigned int i = 0;
while (i!=strlen(level))
{
switch(level[i])
{
case '1': //solid block
dimage(x,y,&img_solid_0);
break;
case 't': //coin (treasure)
dimage(x,y,&img_coin);
break;
case 'd': //dead block
dimage(x,y,&img_dead);
break;
case 'e': //end of level
dimage(x,y,&img_end);
break;
case '3': //block link to the key1
dsubimage(x,y,&img_key1,0,0,16,16,DIMAGE_NONE);
break;
case 'k': //key1
dsubimage(x,y,&img_key1,16,0,16,16,DIMAGE_NONE);
break;
case 'a': //block link to the key2 when it's not powered on
dsubimage(x,y,&img_key2,0,0,16,16,DIMAGE_NONE);
break;
case '4': //block link to the key2
dsubimage(x,y,&img_key2,16,0,16,16,DIMAGE_NONE);
break;
case 'K': //key2
dsubimage(x,y,&img_key2,32,0,16,16,DIMAGE_NONE);
break;
case 'c': //chrono blocks
dimage(x,y,&img_chrono1);
break;
case 'C': //chrono blocks
dsubimage(x,y,&img_chrono2,16,0,16,16,DIMAGE_NONE);
break;
case 'b': //blackout blocks
dimage(x,y,&img_blackout);
break;
case 'B': //damaged block
dimage(x,y,&img_damaged);
break;
case 'l': //chock blocks
dimage(x,y,&img_chock);
break;
case 'i': //ice blocks
dimage(x,y,&img_ice);
break;
case 'S': //chock blocks
dimage(x,y,&img_switch);
break;
case 'h': //void appear blocks
dsubimage(x,y,&img_appear,0,0,16,16,DIMAGE_NONE);
break;
case 'y': //void appear blocks
dsubimage(x,y,&img_appear,0,0,16,16,DIMAGE_NONE);
break;
case 'H': //appear blocks
dsubimage(x,y,&img_appear,16,0,16,16,DIMAGE_NONE);
break;
case 'm': //chronoappear blocks
dsubimage(x,y,&img_chrono2,0,0,16,16,DIMAGE_NONE);
break;
while (i != strlen(level)) {
switch (level[i]) {
case '1': // solid block
dimage(x, y, &img_solid);
break;
case 't': // coin (treasure)
dimage(x, y, &img_coin);
break;
case 'd': // dead block
dimage(x, y, &img_dead);
break;
case 'e': // end of level
dimage(x, y, &img_end);
break;
case '3': // block link to the key1
dsubimage(x, y, &img_key1, 0, 0, 16, 16, DIMAGE_NONE);
break;
case 'k': // key1
dsubimage(x, y, &img_key1, 16, 0, 16, 16, DIMAGE_NONE);
break;
case 'a': // block link to the key2 when it's not on
dsubimage(x, y, &img_key2, 0, 0, 16, 16, DIMAGE_NONE);
break;
case '4': // block link to the key2
dsubimage(x, y, &img_key2, 16, 0, 16, 16, DIMAGE_NONE);
break;
case 'K': // key2
dsubimage(x, y, &img_key2, 32, 0, 16, 16, DIMAGE_NONE);
break;
case 'c': // chrono blocks
dimage(x, y, &img_chrono1);
break;
case 'C': // chrono blocks
dsubimage(x, y, &img_chrono2, 16, 0, 16, 16,
DIMAGE_NONE);
break;
case 'b': // blackout blocks
dimage(x, y, &img_blackout);
break;
case 'B': // damaged block
dimage(x, y, &img_damaged);
break;
case 'l': // chock blocks
dimage(x, y, &img_chock);
break;
case 'i': // chock blocks
dimage(x, y, &img_ice);
break;
case 'S': // chock blocks
dimage(x, y, &img_switch);
break;
case 'h': // void appear blocks
dsubimage(x, y, &img_appear, 0, 0, 16, 16, DIMAGE_NONE);
break;
case 'H': // appear blocks
dsubimage(x, y, &img_appear, 16, 0, 16, 16,
DIMAGE_NONE);
break;
case 'y': // appear blocks
dsubimage(x, y, &img_appear, 0, 0, 16, 16, DIMAGE_NONE);
break;
case 'm': // chronoappear blocks
dsubimage(x, y, &img_chrono2, 0, 0, 16, 16,
DIMAGE_NONE);
break;
case 'z': // nbswitch blocks
dimage(x, y, &img_nbswitch);
break;
case 'r': // rough blocks
dimage(x, y, &img_rough);
break;
}
x+=16;
if(x==16*25)
{
x=0;
y+=16;
x += 16;
if (x == 16 * 25) {
x = 0;
y += 16;
}
i++;
}
@ -113,34 +122,41 @@ void draw_level(char level[])
void draw_blackout(int x, int y)
{
x+=5;
y+=5;
drect(0, 0, 395, y-VISIBLE_RECT, C_BLACK); //top rect
drect(0, y-VISIBLE_RECT, x-VISIBLE_RECT, y+VISIBLE_RECT, C_BLACK); //left rect
drect(x+VISIBLE_RECT, y-VISIBLE_RECT, 395, y+VISIBLE_RECT, C_BLACK); //right rect
drect(0, y+VISIBLE_RECT, 395, 223, C_BLACK); //bottom rect
x += 5;
y += 5;
drect(0, 0, 395, y - VISIBLE_RECT, C_BLACK); // top rect
drect(0, y - VISIBLE_RECT, x - VISIBLE_RECT, y + VISIBLE_RECT,
C_BLACK); // left rect
drect(x + VISIBLE_RECT, y - VISIBLE_RECT, 395, y + VISIBLE_RECT,
C_BLACK); // right rect
drect(0, y + VISIBLE_RECT, 395, 223, C_BLACK); // bottom rect
}
void draw_timer(unsigned int frame)
{
dprint_opt(0, 0, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "%u.%02u",(frame)/FPS, (frame)%FPS);
float framefloat = frame;
dprint_opt(0, 0, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "%.2j",
(int)(framefloat / FPS * 100));
}
void draw_end(int framelevel, int id_level, char record)
{
float framefloat = framelevel;
dimage(144,60,&img_endscreen);
if(record!=2)
{
dprint_opt(220, 115, C_WHITE, C_BLACK, DTEXT_LEFT, DTEXT_TOP, "%d", framelevel);
dprint(166, 87, C_RED, "%.2j",(int)(framefloat/FPS*100));
dimage(144, 60, &img_endscreen);
if (record != 2) {
dprint(166, 87, C_RED, "%.2j", (int)(framefloat / FPS * 100));
check_medal(framelevel, id_level, 178, 140);
if(record==1) dimage(60,100,&img_new);
}
else
{
if (record == 1)
dimage(60, 100, &img_new);
} else {
dprint(166, 87, C_RED, "GG !");
dprint(178, 140, C_RED, "%.2j",(int)(framefloat/FPS*100));
dprint(178, 140, C_RED, "%.2j", (int)(framefloat / FPS * 100));
}
dupdate();
}
void draw_nbswitch(int nbswitch)
{
dimage(300, 150, &img_nbswitchlayout);
dprint(335, 175, C_RED, "%d", nbswitch);
}

42
src/friction.c Normal file
View File

@ -0,0 +1,42 @@
#include "friction.h"
#include "collide.h"
void mod_accel_and_fric(float *acceleration, float *friction, int x, int y,
char level[])
{
*acceleration = HACCELERATION;
*friction = HFRICTION;
if (!mod_ice(acceleration, friction, x, y, level) &&
!mod_rough(acceleration, friction, x, y, level))
mod_solid(acceleration, friction, x, y, level);
}
int mod_ice(float *acceleration, float *friction, int x, int y, char level[])
{
if (collide(x, y - 1, level, 'i') || collide(x, y + 1, level, 'i')) {
*friction /= 3.0;
*acceleration /= 2.0;
return 1;
}
return 0;
}
int mod_rough(float *acceleration, float *friction, int x, int y, char level[])
{
if (collide(x, y - 1, level, 'r') || collide(x, y + 1, level, 'r')) {
*friction *= 3.0;
*acceleration *= 2.0;
return 1;
}
return 0;
}
int mod_solid(float *acceleration, float *friction, int x, int y, char level[])
{
if (collide_solid(x, y - 1, level) || collide_solid(x, y + 1, level)) {
*friction *= 2.0;
*acceleration *= 2.0;
return 1;
}
return 0;
}

Some files were not shown because too many files have changed in this diff Show More