From: Laszlo T. <ave...@us...> - 2004-11-28 19:38:32
|
Update of /cvsroot/gemrb/gemrb/gemrb/GUIScripts/iwd2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7904/iwd2 Modified Files: GUIJRNL.py Log Message: fixed Journal time in bg2/iwd2 Index: GUIJRNL.py =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/GUIScripts/iwd2/GUIJRNL.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GUIJRNL.py 23 Oct 2004 13:01:43 -0000 1.1 --- GUIJRNL.py 28 Nov 2004 19:36:00 -0000 1.2 *************** *** 29,38 **** ################################################### JournalWindow = None ! JournalSection = 0 ################################################### def OpenJournalWindow (): global JournalWindow if CloseOtherWindow (OpenJournalWindow): GemRB.HideGUI () --- 29,48 ---- ################################################### JournalWindow = None ! Chapter = 0 ! StartTime = 0 ! StartYear = 0 ################################################### def OpenJournalWindow (): + global StartTime, StartYear global JournalWindow + Table = GemRB.LoadTable("YEARS") + #StartTime is the time offset for ingame time, beginning from the startyear + StartTime = GemRB.GetTableValue(Table, "STARTTIME", "VALUE") / 4500 + #StartYear is the year of the lowest ingame date to be printed + StartYear = GemRB.GetTableValue(Table, "STARTYEAR", "VALUE") + GemRB.UnloadTable(Table) + if CloseOtherWindow (OpenJournalWindow): GemRB.HideGUI () *************** *** 66,70 **** # Title Title = GemRB.GetControl (Window, 5) ! GemRB.SetText (Window, Title, 16202 + JournalSection) # text area --- 76,80 ---- # Title Title = GemRB.GetControl (Window, 5) ! GemRB.SetText (Window, Title, 16202 + Chapter) # text area *************** *** 72,100 **** GemRB.TextAreaClear (Window, Text) ! for i in range (GemRB.GetJournalSize (JournalSection)): ! je = GemRB.GetJournalEntry (JournalSection, i) if je == None: continue ! # FIXME: the date computed here is wrong by approx. time ! # of the first journal entry compared to journal in ! # orig. game. So it's probably computed since "awakening" ! # there instead of start of the day. ! ! #date = str (1 + int (je['GameTime'] / 86400)) ! #time = str (je['GameTime']) ! ! #GemRB.TextAreaAppend (Window, Text, "[color=FFFF00]Day " + date + ' (' + time + "):[/color]", 3*i) ! GemRB.TextAreaAppend (Window, Text, je['Text'], 2*i) ! GemRB.TextAreaAppend (Window, Text, "", 2*i + 1) ################################################### def JournalPrevSectionPress (): ! global JournalSection ! if JournalSection > 0: ! JournalSection = JournalSection - 1 UpdateJournalWindow () --- 82,110 ---- GemRB.TextAreaClear (Window, Text) ! for i in range (GemRB.GetJournalSize (Chapter)): ! je = GemRB.GetJournalEntry (Chapter, i) if je == None: continue ! hours = je['GameTime'] / 4500 ! days = int(hours/24) ! year = str (StartYear + int(days/365)) ! dayandmonth = StartTime + days%365 ! GemRB.SetToken("GAMEDAY", str(days) ) ! GemRB.SetToken("HOUR",str(hours%24 ) ) ! GemRB.SetVar("DAYANDMONTH",dayandmonth) ! GemRB.SetToken("YEAR",year) ! GemRB.TextAreaAppend (Window, Text, "[color=FFFF00]"+GemRB.GetString(15980)+"[/color]", 3*i) ! GemRB.TextAreaAppend (Window, Text, je['Text'], 3*i+1) ! GemRB.TextAreaAppend (Window, Text, "", 3*i + 2) ################################################### def JournalPrevSectionPress (): ! global Chapter ! if Chapter > 0: ! Chapter = Chapter - 1 UpdateJournalWindow () *************** *** 102,110 **** ################################################### def JournalNextSectionPress (): ! global JournalSection ! #if GemRB.GetJournalSize (JournalSection + 1) > 0: ! if JournalSection < GemRB.GetVar("chapter"): ! JournalSection = JournalSection + 1 UpdateJournalWindow () --- 112,120 ---- ################################################### def JournalNextSectionPress (): ! global Chapter ! #if GemRB.GetJournalSize (Chapter + 1) > 0: ! if Chapter < GemRB.GetVar("chapter"): ! Chapter = Chapter + 1 UpdateJournalWindow () |