Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Port: NotTetris2 #1087

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions ports/nottetris2/Nottetris2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
# Below we assign the source of the control folder (which is the PortMaster folder) based on the distro:
if [ -d "/opt/system/Tools/PortMaster/" ]; then
controlfolder="/opt/system/Tools/PortMaster"
elif [ -d "/opt/tools/PortMaster/" ]; then
controlfolder="/opt/tools/PortMaster"
elif [ -d "$XDG_DATA_HOME/PortMaster/" ]; then
controlfolder="$XDG_DATA_HOME/PortMaster"
else
controlfolder="/roms/ports/PortMaster"
fi

source $controlfolder/control.txt # We source the control.txt file contents here
[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"
get_controls # We pull the controller configs from the get_controls function from the control.txt file here

GAMEDIR="/$directory/ports/nottetris2"
LAUNCH_GAME="nottetris2"

# Log the execution of the script, the script overwrites itself on each launch
> "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1

# Some ports like to create save files or settings files in the user's home folder or other locations.
# Love2D uses XDG_DATA_HOME for this
export XDG_DATA_HOME="$GAMEDIR/saves" # allowing saving to the same path as the game
export XDG_CONFIG_HOME="$GAMEDIR/saves"
mkdir -p "$XDG_DATA_HOME"
mkdir -p "$XDG_CONFIG_HOME"

# If a port uses GL4ES (libgl.so.1) a folder named gl4es.aarch64 etc. needs to be created with the libgl.so.1 file in it. This makes sure that each cfw and device get the correct GL4ES export.
if [ -f "${controlfolder}/libgl_${CFW_NAME}.txt" ]; then
source "${controlfolder}/libgl_${CFW_NAME}.txt"
else
source "${controlfolder}/libgl_default.txt"
fi

# Port specific additional libraries should be included within the port's directory in a separate subfolder named libs.aarch64, libs.armhf or libs.x64
export LD_LIBRARY_PATH="$GAMEDIR/libs.${DEVICE_ARCH}:$LD_LIBRARY_PATH"

# We switch to the port's directory location below
cd $GAMEDIR

# Make sure uinput is accessible so we can make use of the gptokeyb controls. 351Elec/AmberElec and JelOS always runs in root, naughty naughty.
# The other distros don't so the $ESUDO variable provides the sudo or not dependant on the OS this script is run from.
$ESUDO chmod 666 /dev/uinput

export TEXTINPUTINTERACTIVE="Y" # enables interactive text input mode for gptokeyb (for high score names)
export TEXTINPUTNOAUTOCAPITALS="Y" # disables automatic capitalisation of first letter of words in interactive text input mode

# We launch gptokeyb using this $GPTOKEYB variable as it will take care of sourcing the executable from the central location,
# assign the appropriate exit hotkey dependent on the device (ex. select + start for rg351 devices and minus + start for the
# rgb10) and assign the appropriate method for killing an executable dependent on the OS the port is run from.
$GPTOKEYB "love.${DEVICE_ARCH}" -c $GAMEDIR/nottetris2.gptk &
pm_platform_helper "./bin/love.${DEVICE_ARCH}"
./bin/love.${DEVICE_ARCH} "$LAUNCH_GAME"

# Cleanup any running gptokeyb instances, and any platform specific stuff.
pm_finish
25 changes: 25 additions & 0 deletions ports/nottetris2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Notes

Ready to run port, with prebuilt libraries for Love2D 0.7.2 included.

Thanks to Maurice and the team at [stabyourself.net](https://stabyourself.net/nottetris2/) for making this game!

## Controls

| Button | Action |
|--|--|
|Up|Up|
|Down|Down|
|Left|Left|
|Right|Right|
|Start|Enter|
|Select|Escape|
|A / Y / R1 / R2|Rotate right|
|B / X / L1 / L2|Rotate left|
|Start + Down|Enter text entry mode (Start again to confirm text)|

## Compile

* libphysfs was manually compiled for aarch64 from source [https://icculus.org/physfs/](https://icculus.org/physfs/).
* Love2D binary and other libraries were obtained from the binaries checked in here [https://github.com/Cebion/love2d_aarch64](https://github.com/Cebion/love2d_aarch64).
* Game source from [https://github.com/Stabyourself/nottetris2](https://github.com/Stabyourself/nottetris2)
11 changes: 11 additions & 0 deletions ports/nottetris2/gameinfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version='1.0' encoding='utf-8'?>
<gameList>
<game>
<path>./Nottetris2.sh</path>
<name>Not Tetris 2</name>
<desc>Not Tetris 2 is the spiritual successor of the classic Tetris mixed with physics. The result is a fun spinoff in which blocks are no longer bound to the usual grid. Blocks can be rotated and placed at any angle, resulting in a complete mess if not careful. And with the newest cutting edge technology, Not tetris 2 allows line clears when the lines are sufficiently filled.</desc>
<developer>StabYourself.net</developer>
<genre>Arcade</genre>
<image>./nottetris2/screenshot.jpg</image>
</game>
</gameList>
Binary file added ports/nottetris2/nottetris2/bin/love.aarch64
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions ports/nottetris2/nottetris2/libs.aarch64/libphysfs.so
Binary file not shown.
Binary file not shown.
34 changes: 34 additions & 0 deletions ports/nottetris2/nottetris2/nottetris2.gptk
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Base controls
start = enter
guide = escape

a = x
b = z

up = up
down = down
left = left
right = right

# Text entry for high scores is supported through Interatice Text Input mode
# https://portmaster.games/gptokeyb-documentation.html#interactive-text-input

# Redundant controls for special consoles

x = z
y = x

l1 = z
l2 = z
l3 = z
r1 = x
r2 = x
r3 = x

right_analog_left = z
right_analog_right = x

left_analog_up = up
left_analog_down = down
left_analog_left = left
left_analog_right = right
13 changes: 13 additions & 0 deletions ports/nottetris2/nottetris2/nottetris2/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.
2 changes: 2 additions & 0 deletions ports/nottetris2/nottetris2/nottetris2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# nottetris2
Runs on LÖVE 0.7.2
9 changes: 9 additions & 0 deletions ports/nottetris2/nottetris2/nottetris2/conf.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function love.conf(t)
t.title = "Not Tetris 2"
t.author = "Maurice"
t.identity = "not_tetris_2"
t.screen.width = 800
t.screen.height = 720
t.screen.fsaa = 0
t.screen.vsync = true
end
40 changes: 40 additions & 0 deletions ports/nottetris2/nottetris2/nottetris2/controls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
controls = {}
controls.settings = {}

controls.settings.left = {"key", {"left"}}
controls.settings.right = {"key", {"right"}}
controls.settings.up = {"key", {"up"}}
controls.settings.down = {"key", {"down"}}
controls.settings["return"] = {"key", {"return", "kpenter"}}
controls.settings.escape = {"key", {"escape"}}
controls.settings.rotateleft = {"key", {"y", "z", "w"}}
controls.settings.rotateright = {"key", {"x"}}

--player 2
controls.settings.leftp2 = {"key", {"j"}}
controls.settings.rightp2 = {"key", {"k"}}
controls.settings.downp2 = {"key", {"m"}}
controls.settings.rotateleftp2 = {"key", {"o"}}
controls.settings.rotaterightp2 = {"key", {"p"}}

function controls.check(t, key)
if controls.settings[t][1] == "key" then
for i = 1, #controls.settings[t][2] do
if key == controls.settings[t][2][i] then
return true
end
end
return false
end
end

function controls.isDown(t)
if controls.settings[t][1] == "key" then
for i = 1, #controls.settings[t][2] do
if love.keyboard.isDown(controls.settings[t][2][i]) then
return true
end
end
return false
end
end
102 changes: 102 additions & 0 deletions ports/nottetris2/nottetris2/nottetris2/failed.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
function failed_load()
gamestate = "failed"
tetribodies = {} -- CLEAR ALL
tetrishapes = {} -- PIECES
love.audio.play(gameover2)
end

function failed_draw()
--FULLSCREEN OFFSET
if fullscreen then
love.graphics.translate(fullscreenoffsetX, fullscreenoffsetY)

--scissor
love.graphics.setScissor(fullscreenoffsetX, fullscreenoffsetY, 160*scale, 144*scale)
end

if gameno == 1 then
love.graphics.draw(gamebackgroundcutoff, 0, 0, 0, scale)
love.graphics.draw(gameovercutoff, 14*scale, 0, 0, scale)
else
love.graphics.draw(gamebackground, 0, 0, 0, scale)
love.graphics.draw(gameover, 16*scale, 0, 0, scale)
end

--SCORES---------------------------------------
--"score"--
offsetX = 0

scorestring = tostring(scorescore)
for i = 1, scorestring:len() - 1 do
offsetX = offsetX - 8*scale
end
love.graphics.print( scorescore, 144*scale + offsetX, 24*scale, 0, scale)


--"level"--
offsetX = 0

scorestring = tostring(levelscore)
for i = 1, scorestring:len() - 1 do
offsetX = offsetX - 8*scale
end
love.graphics.print( levelscore, 136*scale + offsetX, 56*scale, 0, scale)

--"tiles"--
offsetX = 0

scorestring = tostring(linesscore)
for i = 1, scorestring:len() - 1 do
offsetX = offsetX - 8*scale
end
love.graphics.print( linesscore, 136*scale + offsetX, 80*scale, 0, scale)
-----------------------------------------------


--FULLSCREEN OFFSET
if fullscreen then
love.graphics.translate(-fullscreenoffsetX, -fullscreenoffsetY)

--scissor
love.graphics.setScissor()
end
end

function failed_update()

end

function failed_checkhighscores()
highscoreno = 0
selectblink = true
oldtime = love.timer.getTime()
for i = 1, 3 do
if scorescore > highscore[i] then
if i == 1 then
highscore[3] = highscore[2]
highscore[2] = highscore[1]
highscorename[3] = highscorename[2]
highscorename[2] = highscorename[1]
elseif i == 2 then
highscore[3] = highscore[2]
highscorename[3] = highscorename[2]
end

highscoreno = i
highscorename[i] = ""
highscore[i] = scorescore
cursorblink = true
love.audio.play(highscoreintro)
highscoremusicstart = love.timer.getTime()
musicchanged = false
gamestate = "highscoreentry"
break
end
end
if highscoreno == 0 then--no new highscore
gamestate = "menu"
if musicno < 4 then
love.audio.play(music[musicno])
end
end
end
Loading