Novo escripe para replacar as labels no skool

This commit is contained in:
Pedro de Oliveira 2013-06-25 20:29:31 +01:00
parent 001f5ee346
commit 68e98f8fa2
6 changed files with 76 additions and 15614 deletions

View File

@ -7,7 +7,9 @@ PARADISECAFE=ParadiseCafe
all: all:
rm -rf $(OUTPUT) rm -rf $(OUTPUT)
mkdir -p $(OUTPUT) mkdir -p $(OUTPUT)
#sna2skool.py $(SNA2SKOOL_OPTIONS) -c $(PARADISECAFE).ctl $(PARADISECAFE).z80 > $(PARADISECAFE).skool sna2skool.py $(SNA2SKOOL_OPTIONS) -c $(PARADISECAFE).ctl $(PARADISECAFE).z80 > $(PARADISECAFE).skool
python labeler.py > $(PARADISECAFE)2.skool
mv $(PARADISECAFE)2.skool $(PARADISECAFE).skool
skool2html.py $(SKOOL2HTML_OPTIONS) -H $(PARADISECAFE).skool skool2html.py $(SKOOL2HTML_OPTIONS) -H $(PARADISECAFE).skool
install: install:

View File

@ -1,8 +1,6 @@
;b $4000 screen$ ;b $4000 screen$
; $4000,$1b00 #UDGTABLE { #SCR(loading) | Ecrã de entrada - screen$. } TABLE# ; $4000,$1b00 #UDGTABLE { #SCR(loading) | Ecrã de entrada - screen$. } TABLE#
;i $5b00
;b $5B00 System variables (?) ;b $5B00 System variables (?)
;b $5CB6 Channel infomation (?) ;b $5CB6 Channel infomation (?)
@ -11,18 +9,24 @@
;b $5E27 Basic stacks (novo) ;b $5E27 Basic stacks (novo)
c $7530 Game over(?) ; @label:$7530=game_over
c $7530 Game over
c $75CF c $75CF
; @label:$75E2=frame_prisao
b $75E2 Prisão b $75E2 Prisão
E $75E2 #HTML[#CALL:decode_data($8970,$75E2)] E $75E2 #HTML[#CALL:decode_data($8970,$75E2)]
; @label:$7799=frame_canhola_1
b $7799 Canhola - Frame 1 b $7799 Canhola - Frame 1
$7799 #HTML[#CALL:decode_data($8C30,$7799)] $7799 #HTML[#CALL:decode_data($8C30,$7799)]
; @label:$77B6=frame_canhola_2
b $77B6 Canhola - Frame 2 b $77B6 Canhola - Frame 2
$77B6 #HTML[#CALL:decode_data($8C30,$77B6)] $77B6 #HTML[#CALL:decode_data($8C30,$77B6)]
; @label:$77D5=frame_the_end
b $77D5 The End b $77D5 The End
$77D5 #HTML[#CALL:decode_data($3C00,$77D5)] $77D5 #HTML[#CALL:decode_data($3C00,$77D5)]
@ -37,7 +41,7 @@ c $77EA Inicio do codigo!
$7809,6 Define CHARS em $3C00 $7809,6 Define CHARS em $3C00
$780F,6 Desenha #R$788D $780F,6 Desenha #R$788D
$7815,3 HL com #R$89A6 $7815,3 HL com #R$89A6
$7818,2 Inutil(?) é repetida abaixo em #R$7835 $7818,2 Inutil(?) é repetida abaixo
$781A,3 AT $781A,3 AT
$781D,3 X = $09 $781D,3 X = $09
$7820,3 Y = 00 $7820,3 Y = 00
@ -62,7 +66,7 @@ c $77EA Inicio do codigo!
$7880,2 Subtrai $80 $7880,2 Subtrai $80
$7882,8 Corre o "randomizer" o numero de vezes que estiver em A $7882,8 Corre o "randomizer" o numero de vezes que estiver em A
; @label:$788D=frame_ecra_entrada ; @label:$788D=frame_inicio
b $788D Ecrã de entrada b $788D Ecrã de entrada
$788D #HTML[#CALL:decode_data($3C00,$788D)] $788D #HTML[#CALL:decode_data($3C00,$788D)]
@ -101,18 +105,23 @@ c $7DAB Verifica colisao com a porta(main loop)
z $7DE1 z $7DE1
c $7DEA Policia c $7DEA Policia
; @label:$7EE9=frame_balao_esta_tudo_bem
b $7EE9 Então está tudo bem? b $7EE9 Então está tudo bem?
$7EE9 #HTML[#CALL:decode_data($F641,$7EE9)] $7EE9 #HTML[#CALL:decode_data($F641,$7EE9)]
; @label:$7F15=frame_balao_esta_sim_seu_guarda
b $7F15 Está sim seu guarda b $7F15 Está sim seu guarda
$7F15 #HTML[#CALL:decode_data($F6A1,$7F15)] $7F15 #HTML[#CALL:decode_data($F6A1,$7F15)]
; @label:$7F2C=frame_limpa_balao_esquerdo
b $7F2C Limpa balão - esquerdo b $7F2C Limpa balão - esquerdo
$7F2C #HTML[#CALL:decode_data($F6A1,$7F2C)] $7F2C #HTML[#CALL:decode_data($F6A1,$7F2C)]
; @label:$7F41=frame_limpa_chao
b $7F41 Limpa chão b $7F41 Limpa chão
$7F41 #HTML[#CALL:decode_data($F701,$7F41)] $7F41 #HTML[#CALL:decode_data($F701,$7F41)]
; @label:$7F52=chars1
b $7F52 CHARS b $7F52 CHARS
;t $826A ;t $826A
@ -150,6 +159,7 @@ b $8A09 Esta correcto o seu nome ?
b $8A29 Duas linhas pretas b $8A29 Duas linhas pretas
$8A29 #HTML[#CALL:decode_data($3C00,$8A29)] $8A29 #HTML[#CALL:decode_data($3C00,$8A29)]
; @label:$8A70=chars2
b $8A70 CHARS b $8A70 CHARS
c $9088 c $9088
@ -987,4 +997,5 @@ b $C34E ??
; @label:$C34F=variavel_atributos_fadeOut ; @label:$C34F=variavel_atributos_fadeOut
b $C34F Atributos a serem usados no fadeOut b $C34F Atributos a serem usados no fadeOut
; @label:$C350=chars3
b $C350 CHARS b $C350 CHARS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys import sys

57
labeler.py Executable file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
labels = {
'75E2': 'frame_prisao',
'7799': 'frame_canhola_1',
'77B6': 'frame_canhola_2',
'77D5': 'frame_the_end',
'788D': 'frame_inicio',
'7EE9': 'frame_balao_esta_tudo_bem',
'7F15': 'frame_balao_esta_sim_seu_guarda',
'7F2C': 'frame_limpa_balao_esquerdo',
'7F41': 'frame_limpa_chao',
'7F52': 'chars1',
'C34F': 'variavel_atributos_fadeOut',
'89A6': 'string_recordista',
'C33D': 'variavel_arma',
'C337': 'variavel_droga',
'C33C': 'variavel_carteira',
'C346': 'variavel_score',
'C347': 'variavel_score+1',
'C348': 'variavel_score+2',
'C349': 'variavel_score+3',
'C33E': 'variavel_dinheiro',
'C33F': 'variavel_dinheiro+1',
'C340': 'variavel_dinheiro+2',
'C341': 'variavel_dinheiro+3',
'B7A4': 'frame_linha_highscore',
}
regex = [
r"(?m)LD A,\((\$[0-9a-fA-F]{4})\)",
r"(?m)LD \((\$[0-9a-fA-F]{4})\),A",
r"(?m)LD HL,(\$[0-9a-fA-F]{4})",
r"(?m)LD \((\$[0-9a-fA-F]{4})\),HL",
r"(?m)LD HL,\((\$[0-9a-fA-F]{4})\)",
r"(?m)LD DE,\$([0-9a-fA-F]{4})",
r"(?m)LD DE,\((\$[0-9a-fA-F]{4})\)"
]
def computereplacement(matchobj):
label = labels.get(matchobj.group(1)[1:])
if label == None:
return matchobj.group(0)
result = matchobj.group(0).replace(matchobj.group(1),label)
return result
skool = open('ParadiseCafe.skool', 'r').read()
for reg in regex:
result = re.sub(reg, computereplacement, skool)
skool = result
print result