-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathspecialfunctions.py
56 lines (46 loc) · 1.59 KB
/
specialfunctions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /usr/bin/python
# Special Functions
# This file contains functions that
# do not belong in classes
# specialfunctions.py is part of Sentience in Space.
#
# Sentience in Space is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Sentience in Space is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Sentience in Space. If not, see <http://www.gnu.org/licenses/>.
import pygame
from consts import *
# Turn an integer into a big endian hex string
makehex = lambda value, size = 1: eval(('"%.' + str(size)) + 'x"%' + str(value))
# parse a "journal entry" formatted file
def parsejournal(file_name):
f = open(file_name, 'r')
j = f.read()
f.close()
j = j.split('\n')
out = []# returned data
data = []# temporary storage
store = False
for entry in j:
if not store:
if entry == '-----BEGIN ENTRY-----':
store = True
data = []
else:
if entry == '-----END ENTRY-----':
store = False
out += [[data[0], data[1:]]]
data = []
else:
data += [entry]
return out
def parsedialogue(file_name):
return None