Compare commits
	
		
			39 Commits
		
	
	
		
			e0b8386849
			...
			level_pars
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						b91ebeb775
	
				 | 
					
					
						|||
| 
						
						
							
						
						ab687f8f6d
	
				 | 
					
					
						|||
| 
						
						
							
						
						bef95df6a1
	
				 | 
					
					
						|||
| 
						
						
							
						
						24435a3c15
	
				 | 
					
					
						|||
| 
						
						
							
						
						0c3a36f1fd
	
				 | 
					
					
						|||
| 
						
						
							
						
						a39c419e5f
	
				 | 
					
					
						|||
| 
						
						
							
						
						9ef762268f
	
				 | 
					
					
						|||
| 
						
						
							
						
						e50f516b11
	
				 | 
					
					
						|||
| 
						
						
							
						
						f9e28fa0e2
	
				 | 
					
					
						|||
| 
						
						
							
						
						38a054dec1
	
				 | 
					
					
						|||
| 
						
						
							
						
						fd391ff3bc
	
				 | 
					
					
						|||
| 
						
						
							
						
						fbd9f97429
	
				 | 
					
					
						|||
| 
						
						
							
						
						2a61e8b5d6
	
				 | 
					
					
						|||
| 
						
						
							
						
						4ccbe1dc35
	
				 | 
					
					
						|||
| 
						
						
							
						
						b536d2c987
	
				 | 
					
					
						|||
| 
						
						
							
						
						62fe5f51d3
	
				 | 
					
					
						|||
| 
						
						
							
						
						fd68ef88ec
	
				 | 
					
					
						|||
| 
						
						
							
						
						fd9866e963
	
				 | 
					
					
						|||
| 
						
						
							
						
						a5ce0fd020
	
				 | 
					
					
						|||
| 
						
						
							
						
						dae108c231
	
				 | 
					
					
						|||
| 
						
						
							
						
						2e46d87a84
	
				 | 
					
					
						|||
| 
						
						
							
						
						a4590821be
	
				 | 
					
					
						|||
| 
						
						
							
						
						cf1e1153a3
	
				 | 
					
					
						|||
| 
						
						
							
						
						f3ac1f492c
	
				 | 
					
					
						|||
| 
						
						
							
						
						fb95085bd9
	
				 | 
					
					
						|||
| 
						
						
							
						
						6f9517cee1
	
				 | 
					
					
						|||
| 
						
						
							
						
						8d5f697961
	
				 | 
					
					
						|||
| 
						
						
							
						
						bad8452f3c
	
				 | 
					
					
						|||
| 
						
						
							
						
						f49407baca
	
				 | 
					
					
						|||
| 
						
						
							
						
						e8ed97be9e
	
				 | 
					
					
						|||
| 
						
						
							
						
						f4bcd11bed
	
				 | 
					
					
						|||
| 
						
						
							
						
						4ae0d05b47
	
				 | 
					
					
						|||
| 
						
						
							
						
						a4bf3f616a
	
				 | 
					
					
						|||
| 
						
						
							
						
						8fb54ede26
	
				 | 
					
					
						|||
| 
						
						
							
						
						cb65a188a8
	
				 | 
					
					
						|||
| 
						
						
							
						
						7c29c329b7
	
				 | 
					
					
						|||
| 
						
						
							
						
						f67c2da37f
	
				 | 
					
					
						|||
| 
						
						
							
						
						da8a5b9589
	
				 | 
					
					
						|||
| 
						
						
							
						
						a58421bd19
	
				 | 
					
					
						
							
								
								
									
										61
									
								
								the_parser.p8
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								the_parser.p8
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					pico-8 cartridge // http://www.pico-8.com
 | 
				
			||||||
 | 
					version 41
 | 
				
			||||||
 | 
					__lua__
 | 
				
			||||||
 | 
					-- the parser
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					parser = {}
 | 
				
			||||||
 | 
					mknew(parser)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- calls parse_into with a nop
 | 
				
			||||||
 | 
					-- emit function.
 | 
				
			||||||
 | 
					function parser:parse(str)
 | 
				
			||||||
 | 
					 self:parse_into(str, function() end)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- read a file of commands and
 | 
				
			||||||
 | 
					-- execute them, emitting the
 | 
				
			||||||
 | 
					-- results from each call into
 | 
				
			||||||
 | 
					-- `emit` as a table per row.
 | 
				
			||||||
 | 
					--
 | 
				
			||||||
 | 
					-- a "command" is a method on
 | 
				
			||||||
 | 
					-- self. a row alternates
 | 
				
			||||||
 | 
					-- commands with args. when
 | 
				
			||||||
 | 
					-- calling a command, it also
 | 
				
			||||||
 | 
					-- gets a table of previous
 | 
				
			||||||
 | 
					-- results as the first arg.
 | 
				
			||||||
 | 
					-- args are split on ','.
 | 
				
			||||||
 | 
					function parser:parse_into(str, emit)
 | 
				
			||||||
 | 
					 for row in all(split(str, "\n")) do
 | 
				
			||||||
 | 
					  local prev = {}
 | 
				
			||||||
 | 
					  local sectors = split(row, ":")
 | 
				
			||||||
 | 
					  for i=1,#sectors,2 do
 | 
				
			||||||
 | 
					   local x = self[sectors[i]](self, prev, usplit(sectors[i+1]))
 | 
				
			||||||
 | 
					   if (x) add(prev, x)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  emit(prev)
 | 
				
			||||||
 | 
					 end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- saves prev[sel] as self.name.
 | 
				
			||||||
 | 
					-- if sel is unspecified, saves
 | 
				
			||||||
 | 
					-- all of prev (as a table).
 | 
				
			||||||
 | 
					function parser:saveas(prev, name, sel)
 | 
				
			||||||
 | 
					 self[name] = sel and prev[sel] or prev
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- returns its args, ignoring
 | 
				
			||||||
 | 
					-- prev. Used to stuff things
 | 
				
			||||||
 | 
					-- into prev. args are packed
 | 
				
			||||||
 | 
					-- if there's multiple.
 | 
				
			||||||
 | 
					function parser:val(_, ...)
 | 
				
			||||||
 | 
					 local ret := pack(...)
 | 
				
			||||||
 | 
					 if (#ret == 1) return ret[1]
 | 
				
			||||||
 | 
					 return ret
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function parser:bind(_, fn, ...)
 | 
				
			||||||
 | 
					 local f = self[fn]
 | 
				
			||||||
 | 
					 return function()
 | 
				
			||||||
 | 
					  f(...)
 | 
				
			||||||
 | 
					 end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
							
								
								
									
										6
									
								
								todo.md
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								todo.md
									
									
									
									
									
								
							@@ -1,8 +1,8 @@
 | 
				
			|||||||
## 1. refine existing engine (knowing what I know now)
 | 
					## 1. refine existing engine (knowing what I know now)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- [ ] rewrite event queue as a linked list
 | 
					- [x] rewrite event queue as a linked list
 | 
				
			||||||
- [ ] rewrite animator stacks as linked lists
 | 
					- [x] rewrite animator stacks as linked lists
 | 
				
			||||||
- [ ] rewrite ship/bullet collections as linked lists
 | 
					- [x] rewrite ship/bullet collections as linked lists
 | 
				
			||||||
- [ ] update/draw mode switching system (high-efficiency version)
 | 
					- [ ] update/draw mode switching system (high-efficiency version)
 | 
				
			||||||
- [ ] render ship shields (even for large ships)
 | 
					- [ ] render ship shields (even for large ships)
 | 
				
			||||||
- [ ] duplicate file -- about to split away from Tyrian features
 | 
					- [ ] duplicate file -- about to split away from Tyrian features
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1844
									
								
								updatedshmup.p8
									
									
									
									
									
								
							
							
						
						
									
										1844
									
								
								updatedshmup.p8
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user