Browse Source

add debug options, fix credits skip

Mike Hoskins 3 years ago
parent
commit
9b369717f3
1 changed files with 143 additions and 138 deletions
  1. 143 138
      alter-ego-by-kyuchumimo.lua

+ 143 - 138
alter-ego-by-kyuchumimo.lua

@@ -59,6 +59,11 @@ aey=0
 --palette RGB value
 v=0
 
+options = {
+	music = true,
+	debug = true,
+}
+
 cls()
 map()
 
@@ -403,14 +408,16 @@ level(m)
 function TIC()
 
 	--MUSIC (For loop use t%(spd*rows*#patterns used)==0)
-	--TITLE SCREEN
-	if m==1 and t==0 then music(0,-1,-1,false) end
-	--LEVELS 1-10
-	if m>=2 and m<=11 and t==0 then	music(1,-1,-1,false) end
-	--LEVELS 11-21
-	if m>=12 and m<=21 and t==0 then music(2,-1,-1,false) end
-	--LEVELS 21-???
-	if m>=22 and t==0 then music(3) end
+	if options.music then
+		--TITLE SCREEN
+		if m==1 and t==0 then music(0,-1,-1,false) end
+		--LEVELS 1-10
+		if m>=2 and m<=11 and t==0 then	music(1,-1,-1,false) end
+		--LEVELS 11-21
+		if m>=12 and m<=21 and t==0 then music(2,-1,-1,false) end
+		--LEVELS 21-???
+		if m>=22 and t==0 then music(3) end
+	end
 
 	--TIMER
 	if ptrig==0 then t=t+1 end
@@ -418,10 +425,15 @@ function TIC()
 	--CREDITS
 	if m==0 then
 		map(0,0,30,17)
-		print(t,0,0,15,true,1,true)
-		print(et,0,6,15,true,1,true)
+		if options.debug then
+			print(t,0,0,15,true,1,true)
+			print(et,0,6,15,true,1,true)
+		end
 		fade_in(0)
-    if t==(3*60) or keyp(50) then et=t end
+		if t==(3*60) or keyp(50) then
+			et = 180
+			t = et+180
+		end
 		if t>(et+(3*60)) and et>=0 then 
 			m=m+1
 			t=0
@@ -437,26 +449,18 @@ function TIC()
 		l=5
 		--REMAP
 		cls()
-		map(30*m%270,17*((m-1)//8),30,17,0,0,0,1,
-
-		function(tile)
-		if tile>=80 and tile<=111 and et==-255 then
-			return tile*(t%38//19)
-		end
-		if tile>=80 and tile<=111 and et~=-255 then
-			return tile*(t%10//5)
-		end
-		return tile
-		end)
+		map(30*m%270,17*((m-1)//8),30,17,0,0,0,1)
 
 		fade_in(0)
 		
         particleupdate()
 		particledraw()
-		
+
 		if t<0.4*60 then return end 
-			print("DEBUG: Press X/A and Y/S to switch levels",8,131)
-			print(et,0,0,15,true,1,true)
+			if options.debug then
+				print("DEBUG: Press X/A and Y/S to switch levels",8,131)
+				print(et,0,0,15,true,1,true)
+			end
 		if keyp(50) and et<=0 then
 			music()
 			sfx(51,43,-1,0,15)
@@ -731,130 +735,131 @@ function TIC()
 			end
 		end
 
-	--PIXEL COLLISION
-	if mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8)>=64 and mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8)<=71 and strig==0 then
-		px=px-1
-		sfx(54,72,-1,0)
-		mset((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+((animy*8+(aniy//10))//8)+1,0)
-	end
+		--PIXEL COLLISION
+		if mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8)>=64 and mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8)<=71 and strig==0 then
+			px=px-1
+			sfx(54,72,-1,0)
+			mset((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+((animy*8+(aniy//10))//8)+1,0)
+		end
 
-	--PHANTOM PIXEL COLLISION
-	if mget((30*m%240)+aex//8,(17*(m//8))+((aey+8)//8))>=72 and mget((30*m%240)+aex//8,(17*(m//8))+((aey+8)//8))<=79 and strig==0 then
-		aepx=aepx-1
-		sfx(54,69,-1,0)
-		mset((30*m%240)+aex//8,(17*(m//8))+((aey+8)//8),0)
-	end
-	
-	--HERO DISPLAY
+		--PHANTOM PIXEL COLLISION
+		if mget((30*m%240)+aex//8,(17*(m//8))+((aey+8)//8))>=72 and mget((30*m%240)+aex//8,(17*(m//8))+((aey+8)//8))<=79 and strig==0 then
+			aepx=aepx-1
+			sfx(54,69,-1,0)
+			mset((30*m%240)+aex//8,(17*(m//8))+((aey+8)//8),0)
+		end
+		
+		--HERO DISPLAY
+		
+		--ALTER EGO DISPLAY
+		if aeo==0 then
+			--120=ZX spectrum Mirrored, 116=NES Mirrored
+			aex=120-((animx*8+(anix//10))-120)
+			aey=animy*8+(aniy//10)
+		end
+		if aeo==1 then
+			aex=animx*8+(anix//10)
+			aey=64-((animy*8+(aniy//10))-64)
+		end
 	
-	--ALTER EGO DISPLAY
-	if aeo==0 then
-		--120=ZX spectrum Mirrored, 116=NES Mirrored
-		aex=120-((animx*8+(anix//10))-120)
-		aey=animy*8+(aniy//10)
-	end
-	if aeo==1 then
-		aex=animx*8+(anix//10)
-		aey=64-((animy*8+(aniy//10))-64)
-	end
- 
-	if t>(2*60) then	
-		if strig==0 then
-			spr(265+t%8//2,aex,aey,0,1,0,0,1,2)
+		if t>(2*60) then	
+			if strig==0 then
+				spr(265+t%8//2,aex,aey,0,1,0,0,1,2)
+			else
+				spr(297+t%16//4,aex,aey,0,1,0,0,1,2)
+			end
 		else
-			spr(297+t%16//4,aex,aey,0,1,0,0,1,2)
+			spr(265+((t%20//10)*6),aex,aey,0,1,0,0,1,2)
 		end
-	else
-		spr(265+((t%20//10)*6),aex,aey,0,1,0,0,1,2)
-	end
 	
 	end
 
-	--DEBUG DISPLAY
-	print("DEBUG",0,0,15,true,1,true)
-	--TIMER DEBUG
-	print(t,0,6,15,true,1,true)
-	--SWAP ACTION INPUT DEBUG
-	if btn(4)==true or btn(5)==true then
-		print("true",0,12,15,true,1,true)
-	else
-		print("false",0,12,15,true,1,true)
-	end
-	--MAP SCREEN DEBUG
-	print(m,0,18,15,true,1,true)
+	if options.debug then
+		print("DEBUG",0,0,15,true,1,true)
+		--TIMER DEBUG
+		print(t,0,6,15,true,1,true)
+		--SWAP ACTION INPUT DEBUG
+		if btn(4)==true or btn(5)==true then
+			print("true",0,12,15,true,1,true)
+		else
+			print("false",0,12,15,true,1,true)
+		end
+		--MAP SCREEN DEBUG
+		print(m,0,18,15,true,1,true)
 
-	--SWAP TRIGGER DEBUG	
-	print(strig,22,18,15,true,1,true)
-	
-	--SCREEN HERO SPR POSITION DEBUG
-	print((animx*8+(anix//10)),0,24,15,true,1,true)
-	print((animy*8+(aniy//10))+8,0,30,15,true,1,true)
-	
-	--SCREEN ALTER EGO SPR POSITION DEBUG
-	print(aex,22,24,15,true,1,true)
-	print(aey+8,22,30,15,true,1,true)
+		--SWAP TRIGGER DEBUG	
+		print(strig,22,18,15,true,1,true)
+		
+		--SCREEN HERO SPR POSITION DEBUG
+		print((animx*8+(anix//10)),0,24,15,true,1,true)
+		print((animy*8+(aniy//10))+8,0,30,15,true,1,true)
+		
+		--SCREEN ALTER EGO SPR POSITION DEBUG
+		print(aex,22,24,15,true,1,true)
+		print(aey+8,22,30,15,true,1,true)
 
-	--MAP HERO SPR POSITION DEBUG
-	print((30*m%240)+(animx*8+(anix//10))//8,0,42,15,true,1,true)
-	print((17*(m//8))+((animy*8+(aniy//10))//8)+1,0,48,15,true,1,true)
-	
-	--MAP ALTER EGO SPR POSITION DEBUG
-	print((30*m%240)+aex//8,22,42,15,true,1,true)
-	print((17*(m//8))+((aey+8)//8),22,48,15,true,1,true)
-	
-	--MOVEMENT DEBUG
-	print(anix//10,0,60,15,true,1,true)
-	print(aniy//10,0,66,15,true,1,true)
-	
-	--PIXEL AND PHANTOM PIXEL DEBUG
-	print(px,22,60,15,true,1,true)
-	print(aepx,22,66,15,true,1,true)	
-
-	--MGET DEBUG
-	print(mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10))//8),22,78,15,true,1,true)	
-	print(mget((30*m%240)+(animx*8+(anix//10)-8)//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8),0,84,15,true,1,true)
-	print(mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8),22,84,15,true,1,true)
-	print(mget((30*m%240)+(animx*8+(anix//10)+8)//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8),44,84,15,true,1,true)
-	print(mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10)+16)//8),22,90,15,true,1,true)
- 
-	--MUSIC SPEED DEBUG (0-7)
-	--print(peek(0x13e96),0,102)
-	--print(peek(0x13ec9),22,102)
-	--print(peek(0x13efc),0,108)
-	--print(peek(0x13f2f),22,108)
-	--print(peek(0x13f62),0,114)
-	--print(peek(0x13f95),22,114)
-	--print(peek(0x13fc8),0,120)
-	--print(peek(0x13ffb),22,120)
-
-	--MUSIC POSITION DEBUG
-	print("track:",44,102,15,true,1,true)
-	print(peek(0x13ffc),88,102,15,true,1,true)
-	print("frame:",44,108,15,true,1,true)
-	print(peek(0x13ffd),88,108,15,true,1,true)
-	print("row  :",44,114,15,true,1,true)
-	print(peek(0x13ffe),88,114,15,true,1,true)
-	print("loop :",44,120,15,true,1,true)
-	print(peek(0x13fff),88,120,15,true,1,true)
+		--MAP HERO SPR POSITION DEBUG
+		print((30*m%240)+(animx*8+(anix//10))//8,0,42,15,true,1,true)
+		print((17*(m//8))+((animy*8+(aniy//10))//8)+1,0,48,15,true,1,true)
+		
+		--MAP ALTER EGO SPR POSITION DEBUG
+		print((30*m%240)+aex//8,22,42,15,true,1,true)
+		print((17*(m//8))+((aey+8)//8),22,48,15,true,1,true)
+		
+		--MOVEMENT DEBUG
+		print(anix//10,0,60,15,true,1,true)
+		print(aniy//10,0,66,15,true,1,true)
+		
+		--PIXEL AND PHANTOM PIXEL DEBUG
+		print(px,22,60,15,true,1,true)
+		print(aepx,22,66,15,true,1,true)	
+
+		--MGET DEBUG
+		print(mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10))//8),22,78,15,true,1,true)	
+		print(mget((30*m%240)+(animx*8+(anix//10)-8)//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8),0,84,15,true,1,true)
+		print(mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8),22,84,15,true,1,true)
+		print(mget((30*m%240)+(animx*8+(anix//10)+8)//8,(17*(m//8))+(animy*8+(aniy//10)+8)//8),44,84,15,true,1,true)
+		print(mget((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+(animy*8+(aniy//10)+16)//8),22,90,15,true,1,true)
 	
-	--wait: Time event (2 sec)
-	--if t<2*60 then return end
-	--stuff to do
+		--MUSIC SPEED DEBUG (0-7)
+		--print(peek(0x13e96),0,102)
+		--print(peek(0x13ec9),22,102)
+		--print(peek(0x13efc),0,108)
+		--print(peek(0x13f2f),22,108)
+		--print(peek(0x13f62),0,114)
+		--print(peek(0x13f95),22,114)
+		--print(peek(0x13fc8),0,120)
+		--print(peek(0x13ffb),22,120)
+
+		--MUSIC POSITION DEBUG
+		print("track:",44,102,15,true,1,true)
+		print(peek(0x13ffc),88,102,15,true,1,true)
+		print("frame:",44,108,15,true,1,true)
+		print(peek(0x13ffd),88,108,15,true,1,true)
+		print("row  :",44,114,15,true,1,true)
+		print(peek(0x13ffe),88,114,15,true,1,true)
+		print("loop :",44,120,15,true,1,true)
+		print(peek(0x13fff),88,120,15,true,1,true)
 		
-	--spr command: spr(id+t%nf//f,x,y,z,s,f,r,w,h)
-	--id=sprite id
-	--t=timer
-	--f=frames to wait for switch sprites
-	--n=number of sprites to switch
-	--Compare between f and n variables for speed
-	--x=x position
-	--y=y position
-	--z=colorkey id to set alpha
-	--s=scale
-	--f=flip(Hflip(1),Vflip(2),HVflip(3))
-	--r=rotate(90 deg(1),180 deg(2),270 deg(3))
-	--w=width of composite sprite
-	--h=height of composite sprite
+		--wait: Time event (2 sec)
+		--if t<2*60 then return end
+		--stuff to do
+			
+		--spr command: spr(id+t%nf//f,x,y,z,s,f,r,w,h)
+		--id=sprite id
+		--t=timer
+		--f=frames to wait for switch sprites
+		--n=number of sprites to switch
+		--Compare between f and n variables for speed
+		--x=x position
+		--y=y position
+		--z=colorkey id to set alpha
+		--s=scale
+		--f=flip(Hflip(1),Vflip(2),HVflip(3))
+		--r=rotate(90 deg(1),180 deg(2),270 deg(3))
+		--w=width of composite sprite
+		--h=height of composite sprite
+	end --if options.debug
 
 	--end of function TIC()
 end