mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-03-01 03:30:04 +00:00
Moved tools into their own dir.
This commit is contained in:
parent
cbf17851b3
commit
04495cf36e
13
Platform/Apple/virtual/tools/getBlockTypes.xslt
Normal file
13
Platform/Apple/virtual/tools/getBlockTypes.xslt
Normal file
@ -0,0 +1,13 @@
|
||||
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns="outlaw" xpath-default-namespace="outlaw">
|
||||
|
||||
<xsl:template match="block">
|
||||
<xsl:message><xsl:value-of select="@type"/></xsl:message>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
62
Platform/Apple/virtual/tools/prng.rb
Executable file
62
Platform/Apple/virtual/tools/prng.rb
Executable file
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
MULT = 32
|
||||
#BIG_NUM = 65521 # should be prime
|
||||
#BIG_NUM = 65519
|
||||
BIG_NUM = 32749
|
||||
|
||||
def linCong(seed)
|
||||
if seed == 0
|
||||
seed = 1
|
||||
else
|
||||
seed &= 0x7FFF
|
||||
seed >= BIG_NUM and seed -= BIG_NUM
|
||||
5.times {
|
||||
seed <<= 1
|
||||
seed >= BIG_NUM and seed -= BIG_NUM
|
||||
}
|
||||
end
|
||||
return seed
|
||||
end
|
||||
|
||||
def rnd02(seed)
|
||||
magic = 0x2227
|
||||
if seed == 0
|
||||
seed = magic
|
||||
elsif seed == 0x8000
|
||||
seed = 0
|
||||
else
|
||||
seed <<= 1
|
||||
if (seed & 0x8000) > 0
|
||||
seed = (seed & 0x7fff) ^ magic
|
||||
end
|
||||
end
|
||||
return seed
|
||||
end
|
||||
|
||||
done = {}
|
||||
|
||||
minLoop = nil
|
||||
(BIG_NUM..0xFFFF).each { |invalSeed|
|
||||
out = linCong(invalSeed)
|
||||
out >= 0 && out < BIG_NUM or raise("Bad: $%x -> $%x" % [invalSeed, out])
|
||||
}
|
||||
(0..BIG_NUM-1).each { |startSeed|
|
||||
next if done[startSeed]
|
||||
n = 0
|
||||
seed = startSeed
|
||||
loop do
|
||||
print "%016b %04X -> " % [seed, seed]
|
||||
seed = linCong(seed)
|
||||
puts "%04X" % seed
|
||||
if done[seed]
|
||||
length = n - done[seed]
|
||||
puts "loop at #{startSeed} -> #{seed}: length=#{length}"
|
||||
minLoop = minLoop ? [minLoop, length].min : length
|
||||
break
|
||||
end
|
||||
done[seed] = n
|
||||
n += 1
|
||||
end
|
||||
}
|
||||
puts "minLoop=#{minLoop}"
|
56
Platform/Apple/virtual/tools/replaceGetKey.xslt
Normal file
56
Platform/Apple/virtual/tools/replaceGetKey.xslt
Normal file
@ -0,0 +1,56 @@
|
||||
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns="outlaw" xpath-default-namespace="outlaw">
|
||||
|
||||
<xsl:template match="block[matches(@type, 'text_print')][matches(value/block/field/text(), '\(press any key\)', 'i')]">
|
||||
|
||||
<xsl:variable name="context" select="concat(ancestor::map/@name, ': ', ancestor::script/@name)"/>
|
||||
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="next/block[@type='text_getanykey']/next/block[@type='text_clear_window']">
|
||||
<!--<xsl:message>Got clear</xsl:message>-->
|
||||
<block type="text_promptanykey" id="@id">
|
||||
<field name="CLEAR">1</field>
|
||||
<xsl:copy-of select="next/block[@type='text_getanykey']/next/block[@type='text_clear_window']/next"/>
|
||||
</block>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="next/block[@type='text_getanykey']">
|
||||
<!--<xsl:message>No clear, next-next is: <xsl:value-of select="next/block[@type='text_getanykey']/next/block/@type"/></xsl:message>-->
|
||||
<block type="text_promptanykey" id="@id">
|
||||
<field name="CLEAR">0</field>
|
||||
<xsl:copy-of select="next/block[@type='text_getanykey']/next"/>
|
||||
</block>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="next/block/next/block[@type='text_getanykey']">
|
||||
<!--<xsl:message><xsl:value-of select="$context"/>...Got intervening: <xsl:value-of select="next/block/@type"/></xsl:message>-->
|
||||
<block type="text_promptanykey" id="@id">
|
||||
<field name="CLEAR">0</field>
|
||||
<xsl:element name="{next/block/name()}">
|
||||
<xsl:copy-of select="next/block/@*"/>
|
||||
<xsl:copy-of select="next/block/*[not(matches(name(), 'next'))]"/>
|
||||
</xsl:element>
|
||||
<xsl:copy-of select="next/block/next/block/next"/>
|
||||
</block>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:message><xsl:value-of select="$context"/>... Hmm, next is: <xsl:value-of select="next/block/@type"/></xsl:message>
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- Leave everything else intact -->
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Loading…
x
Reference in New Issue
Block a user