- Icon resource for Windows added
- Zoom and fullscreen controlled from Lua - Basic gamepad support
This commit is contained in:
@@ -81,13 +81,13 @@ function abad_state_normal()
|
||||
end
|
||||
abad_make_safe()
|
||||
|
||||
if btn(KEY_RIGHT) then
|
||||
if btn(keyRight) or pad(btnRight) then
|
||||
abad.update=abad_state_walking
|
||||
abad.flip=false
|
||||
elseif btn(KEY_LEFT) then
|
||||
elseif btn(keyLeft) or pad(btnLeft) then
|
||||
abad.update=abad_state_walking
|
||||
abad.flip=true
|
||||
elseif btn(KEY_UP) then
|
||||
elseif btn(keyUp) or pad(btnUp) then
|
||||
abad.update=abad_state_jumping
|
||||
abad.step=0
|
||||
abad.jumpfwd=false
|
||||
@@ -96,11 +96,11 @@ function abad_state_normal()
|
||||
abad.jump=nil
|
||||
end
|
||||
playsnd(audio_abad_jump)
|
||||
elseif btn(KEY_DOWN) then
|
||||
elseif btn(keyDown) or pad(btnDown) then
|
||||
abad.update=abad_state_crouch
|
||||
elseif btn(KEY_Z) then
|
||||
abad.respawning=240
|
||||
elseif btnp(KEY_SPACE) and cacau.hab==-1 then
|
||||
--elseif btn(KEY_Z) then
|
||||
-- abad.respawning=240
|
||||
elseif btn(keyShoot) or pad(btnShoot) and cacau.hab==-1 then
|
||||
playsnd(audio_abad_shot)
|
||||
abad.update=abad_state_fire
|
||||
abad.wait=0
|
||||
@@ -116,7 +116,7 @@ function abad_state_crouch()
|
||||
abad.step=0
|
||||
abad.jumpfwd=false
|
||||
|
||||
if not btn(KEY_DOWN) then
|
||||
if not (btn(keyDown) or pad(btnDown)) then
|
||||
abad.update=abad_state_normal
|
||||
abad.bb.y=0
|
||||
abad.bb.h=16
|
||||
@@ -185,7 +185,7 @@ function abad_state_walking()
|
||||
|
||||
abad_make_safe()
|
||||
|
||||
if btn(KEY_UP) then
|
||||
if btn(keyUp) or pad(btnUp) then
|
||||
abad.update=abad_state_jumping
|
||||
abad.step=0
|
||||
abad.jumpfwd=true
|
||||
@@ -195,18 +195,18 @@ function abad_state_walking()
|
||||
end
|
||||
playsnd(audio_abad_jump)
|
||||
return
|
||||
elseif btn(KEY_DOWN) then
|
||||
elseif btn(keyDown) or pad(btnDown) then
|
||||
abad.update=abad_state_crouch
|
||||
elseif btn(KEY_SPACE) and cacau.hab==-1 then
|
||||
elseif btn(keyShoot) or pad(btnShoot) and cacau.hab==-1 then
|
||||
playsnd(audio_abad_shot)
|
||||
abad.update=abad_state_fire
|
||||
abad.wait=0
|
||||
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
|
||||
end
|
||||
|
||||
if btn(KEY_RIGHT) then
|
||||
if btn(keyRight) or pad(btnRight) then
|
||||
abad.flip=false
|
||||
elseif btn(KEY_LEFT) then
|
||||
elseif btn(keyLeft) or pad(btnLeft) then
|
||||
abad.flip=true
|
||||
elseif abad.wait==0 then
|
||||
abad.update=abad_state_normal
|
||||
@@ -297,15 +297,15 @@ function abad_state_stairs()
|
||||
if abad.wait==6 then
|
||||
abad.wait=0
|
||||
|
||||
if btn(KEY_RIGHT) then
|
||||
if btn(keyRight) or pad(btnRight) then
|
||||
abad.flip=false
|
||||
abad_advance()
|
||||
playsnd(audio_low)
|
||||
elseif btn(KEY_LEFT) then
|
||||
elseif btn(keyLeft) or pad(btnLeft) then
|
||||
abad.flip=true
|
||||
abad_advance()
|
||||
playsnd(audio_low)
|
||||
elseif btn(KEY_UP) then
|
||||
elseif btn(keyUp) or pad(btnUp) then
|
||||
if abad.y>0 then
|
||||
if check_tile(abad.hab,abad.x+4,abad.y+8)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+8)==tiletype.stair then
|
||||
abad.y=abad.y-2
|
||||
@@ -316,7 +316,7 @@ function abad_state_stairs()
|
||||
imp.reset()
|
||||
abad.y=32
|
||||
end
|
||||
elseif btn(KEY_DOWN) then
|
||||
elseif btn(keyDown) or pad(btnDown) then
|
||||
if abad.y<32 then
|
||||
if check_tile(abad.hab,abad.x+4,abad.y+16)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+16)==tiletype.stair then
|
||||
abad.y=abad.y+2
|
||||
|
||||
@@ -213,12 +213,6 @@ function batman.update_stairs()
|
||||
if batman.wait>=6 then
|
||||
batman.wait=0
|
||||
|
||||
--if btn(KEY_RIGHT) then
|
||||
-- batman.flip=false
|
||||
-- batman_advance()
|
||||
--elseif btn(KEY_LEFT) then
|
||||
-- batman.flip=true
|
||||
-- batman_advance()
|
||||
if batman.goup then
|
||||
if batman.y>0 then
|
||||
if check_tile(batman.hab,batman.x+4,batman.y+8)==tiletype.stair or (batman.x+4)&7~=0 and check_tile(batman.hab,batman.x+12,batman.y+8)==tiletype.stair then
|
||||
|
||||
@@ -8,7 +8,7 @@ function dead.start()
|
||||
dead.pos[i]=0
|
||||
dead.vel[i]=(200+rnd(400))/400
|
||||
end
|
||||
_update=dead.update
|
||||
game_update=dead.update
|
||||
end
|
||||
|
||||
function dead.update()
|
||||
@@ -39,10 +39,8 @@ function dead.update()
|
||||
end
|
||||
end
|
||||
|
||||
if (dead.count>250 and btnp(KEY_SPACE)) or dead.count>500 then
|
||||
if (dead.count>250 and (btnp(keyShoot) or padp(btnShoot))) or dead.count>500 then
|
||||
game_exit()
|
||||
game_init(true)
|
||||
--_init()
|
||||
--_update=update_game
|
||||
end
|
||||
end
|
||||
@@ -223,12 +223,6 @@ function elalien.update_stairs()
|
||||
if elalien.wait>=6 then
|
||||
elalien.wait=0
|
||||
|
||||
--if btn(KEY_RIGHT) then
|
||||
-- elalien.flip=false
|
||||
-- elalien_advance()
|
||||
--elseif btn(KEY_LEFT) then
|
||||
-- elalien.flip=true
|
||||
-- elalien_advance()
|
||||
if elalien.goup then
|
||||
if elalien.y>0 then
|
||||
if check_tile(elalien.hab,elalien.x+4,elalien.y+8)==tiletype.stair or (elalien.x+4)&7~=0 and check_tile(elalien.hab,elalien.x+12,elalien.y+8)==tiletype.stair then
|
||||
|
||||
@@ -24,16 +24,16 @@ fade = {
|
||||
|
||||
fadeout = function()
|
||||
--print("fading out")
|
||||
fade.old_update=_update
|
||||
_update=fade.update_fadeout
|
||||
fade.old_update=game_update
|
||||
game_update=fade.update_fadeout
|
||||
fade.wait=0
|
||||
fade.step=0
|
||||
end,
|
||||
|
||||
fadeoutin = function()
|
||||
--print("fading outin")
|
||||
fade.old_update=_update
|
||||
_update=fade.update_fadeout
|
||||
fade.old_update=game_update
|
||||
game_update=fade.update_fadeout
|
||||
fade.wait=0
|
||||
fade.step=0
|
||||
fade.outin=true
|
||||
@@ -55,7 +55,7 @@ fade = {
|
||||
end
|
||||
fade.step=fade.step+1
|
||||
if fade.step==7 then
|
||||
_update = fade.old_update
|
||||
game_update = fade.old_update
|
||||
if fade.outin then
|
||||
fade.outin=false;
|
||||
fade.fadein()
|
||||
@@ -66,8 +66,8 @@ fade = {
|
||||
|
||||
fadein = function()
|
||||
--print("fading in")
|
||||
fade.old_update=_update
|
||||
_update=fade.update_fadein
|
||||
fade.old_update=game_update
|
||||
game_update=fade.update_fadein
|
||||
fade.wait=0
|
||||
fade.step=6
|
||||
for i=1,15 do setcolor(i,0,0,0) end
|
||||
@@ -91,7 +91,7 @@ fade = {
|
||||
end
|
||||
fade.step=fade.step-1
|
||||
if fade.step<0 then
|
||||
_update = fade.old_update
|
||||
game_update = fade.old_update
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ function final_init()
|
||||
current_actor=1
|
||||
|
||||
abad.update = abad_nop
|
||||
_update=update_final
|
||||
game_update=update_final
|
||||
next_actor()
|
||||
playmus(audio_final)
|
||||
local r,g,b=getcolor(15)
|
||||
@@ -128,7 +128,7 @@ function next_actor()
|
||||
init_actor("EL ABAD",true,16,16,{0,1,0,2})
|
||||
elseif current_actor==14 then
|
||||
final_count=0
|
||||
_update=update_final2
|
||||
game_update=update_final2
|
||||
fade.fadeoutin()
|
||||
end
|
||||
final_room=final_rooms[current_actor]
|
||||
@@ -150,7 +150,7 @@ function update_final2()
|
||||
end
|
||||
end
|
||||
final_count=final_count+1
|
||||
if final_count==200 or btnp(KEY_SPACE) or btnp(KEY_RETURN) then
|
||||
if final_count==200 or (btnp(keyShoot) or padp(btnShoot)) or btnp(KEY_RETURN) then
|
||||
game_exit()
|
||||
game_init(true)
|
||||
fade.fadeoutin()
|
||||
|
||||
@@ -133,13 +133,13 @@ function game_init(menu)
|
||||
|
||||
if menu then
|
||||
abad.update = abad_nop
|
||||
_update=update_menu
|
||||
game_update=update_menu
|
||||
menu_count=0
|
||||
menu_change_room=300
|
||||
menu_room=rnd(60)
|
||||
playmus(audio_main_song)
|
||||
else
|
||||
_update=update_game
|
||||
game_update=update_game
|
||||
stopmusic()
|
||||
end
|
||||
--fade.fadein()
|
||||
@@ -185,10 +185,10 @@ function update_dialog()
|
||||
text("(Y)es (N)o",25,40,2)
|
||||
|
||||
if btnp(KEY_N) then
|
||||
_update=update_game
|
||||
game_update=update_game
|
||||
elseif btnp(KEY_Y) then
|
||||
mapa_save()
|
||||
_update=update_game
|
||||
game_update=update_game
|
||||
end
|
||||
end
|
||||
|
||||
@@ -220,7 +220,7 @@ function update_game()
|
||||
elseif btnp(KEY_RETURN) then
|
||||
mode=modes.playing
|
||||
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then
|
||||
_update=update_dialog
|
||||
game_update=update_dialog
|
||||
elseif btnp(KEY_C) then
|
||||
mapa_cycle_colors(abad.hab)
|
||||
elseif btnp(KEY_M) then
|
||||
@@ -360,7 +360,7 @@ function update_menu()
|
||||
fireball.update()
|
||||
switches.update()
|
||||
|
||||
if btnp(KEY_SPACE) then
|
||||
if btnp(keyShoot) or padp(btnShoot) then
|
||||
game_exit()
|
||||
game_init()
|
||||
fade.fadeoutin()
|
||||
@@ -390,8 +390,8 @@ function pause()
|
||||
sspr(0,0,128,96,0,0)
|
||||
setdest(0)
|
||||
setsource(tiles)
|
||||
pause_old_update=_update
|
||||
_update=update_pause
|
||||
pause_old_update=game_update
|
||||
game_update=update_pause
|
||||
end
|
||||
|
||||
function update_pause()
|
||||
@@ -405,8 +405,8 @@ function update_pause()
|
||||
setsource(back)
|
||||
sspr(0,0,128,96,0,0)
|
||||
setsource(tiles)
|
||||
_update = pause_old_update
|
||||
elseif btnp(KEY_SPACE) then
|
||||
game_update = pause_old_update
|
||||
elseif btnp(keyShoot) or padp(btnShoot) then
|
||||
game_exit()
|
||||
game_init(true)
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ intro_wait=40
|
||||
intro_step=0
|
||||
|
||||
function intro_init()
|
||||
_update = intro_intro
|
||||
game_update = intro_intro
|
||||
intro_wait=400
|
||||
cls(16)
|
||||
setdest(logo)
|
||||
@@ -19,9 +19,9 @@ function intro_intro()
|
||||
--text("JAILGAMES",40,30,15)
|
||||
text("presenta",48,50,14)
|
||||
intro_wait=intro_wait-1
|
||||
if intro_wait==0 or btnp(KEY_ESCAPE) or btnp(KEY_SPACE) then
|
||||
if intro_wait==0 or btnp(KEY_ESCAPE) or btnp(keyShoot) or padp(btnShoot) then
|
||||
intro_wait=1
|
||||
_update = intro_update
|
||||
game_update = intro_update
|
||||
fade.fadeoutin()
|
||||
end
|
||||
if btnp(KEY_M) then
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
keyUp = KEY_UP
|
||||
keyDown = KEY_DOWN
|
||||
keyLeft = KEY_LEFT
|
||||
keyRight = KEY_RIGHT
|
||||
keyShoot = KEY_SPACE
|
||||
|
||||
btnUp = BTN_UP
|
||||
btnDown = BTN_DOWN
|
||||
btnLeft = BTN_LEFT
|
||||
btnRigth = BTN_RIGHT
|
||||
btnShoot = BTN_A
|
||||
|
||||
function _init()
|
||||
tiles=loadsurf("tiles.gif")
|
||||
setsource(tiles)
|
||||
@@ -29,4 +41,14 @@ function _init()
|
||||
--final_init()
|
||||
end
|
||||
|
||||
function _update() end
|
||||
function _update()
|
||||
if btnp(KEY_F2) then
|
||||
local val = zoom() + 2
|
||||
if val >= 10 then val = 2 end
|
||||
zoom(val)
|
||||
elseif btnp(KEY_F3) then
|
||||
fullscreen(not fullscreen())
|
||||
end
|
||||
|
||||
if (game_update) game_update() end
|
||||
end
|
||||
|
||||
@@ -162,7 +162,7 @@ function mapa_create_minimap()
|
||||
end
|
||||
end
|
||||
end
|
||||
_update=mapa_draw_minimap
|
||||
game_update=mapa_draw_minimap
|
||||
end
|
||||
|
||||
function mapa_draw_minimap()
|
||||
|
||||
@@ -144,8 +144,8 @@ function start_scene(scene,offset)
|
||||
playmus(scenes.current_scene[scenes.dnum].musica)
|
||||
end
|
||||
if offset then scenes.offset=offset end
|
||||
old_update=_update
|
||||
_update=update_scene
|
||||
old_update=game_update
|
||||
game_update=update_scene
|
||||
end
|
||||
|
||||
function playtext(snd)
|
||||
@@ -254,7 +254,7 @@ function update_scene()
|
||||
final_init()
|
||||
fade.fadeoutin()
|
||||
else
|
||||
_update=old_update
|
||||
game_update=old_update
|
||||
end
|
||||
else
|
||||
scenes.dnum=scenes.dnum+1
|
||||
@@ -283,21 +283,22 @@ function update_scene()
|
||||
end
|
||||
|
||||
if scenes.step>8 then
|
||||
if btnp(KEY_SPACE) or btnp(KEY_DOWN) or btnp(KEY_UP) or btnp(KEY_LEFT) or btnp(KEY_RIGHT) or btnp(KEY_RETURN) then
|
||||
if btnp(keyShoot) or btnp(keyDown) or btnp(keyUp) or btnp(keyLeft) or btnp(keyRight) or btnp(KEY_RETURN) or
|
||||
padp(btnShoot) or padp(btnDown) or padp(btnUp) or padp(btnLeft) or padp(btnRight) then
|
||||
if scenes.dnum==#scenes.current_scene then
|
||||
stopmusic()
|
||||
if batman.endgame then
|
||||
final_init()
|
||||
fade.fadeoutin()
|
||||
else
|
||||
_update=old_update
|
||||
game_update=old_update
|
||||
end
|
||||
else
|
||||
scenes.dnum=scenes.dnum+1
|
||||
scenes.step=2
|
||||
end
|
||||
end
|
||||
elseif btnp(KEY_SPACE) then
|
||||
elseif btnp(keyShoot) or padp(btnShoot) then
|
||||
scenes.step=8
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user