home *** CD-ROM | disk | FTP | other *** search
/ Grandes Inventos / INVENTOS.bin / pc / media / shared.dxr / 02002.ls < prev    next >
Encoding:
Text File  |  1996-01-01  |  4.7 KB  |  168 lines

  1. factory TObject
  2. method mnew theName
  3.   instance marker, MyPreload, MyUnload, MyPreload, MyPreload, MyPreload, MyPreload, MyPreload, fName, f3D, fSubsys, fMap, fPrinc, fDudaList, fNextDuda, fDataList, fNextData, fInv, fInvOffset, fSusSubsistemsFlag
  4.   global gPopupBaseSprite, gConsoleText, gIdiom
  5.   set n to the number of cast ("InitMap" & gIdiom)
  6.   if n <> -1 then
  7.     sound playFile 2, "@:ANAL_AU:SHOWINFO"
  8.     SetCast(gConsoleText, n)
  9.     updateStage()
  10.   end if
  11.   set fName to theName
  12.   set ObjectDescriptionCast to the number of cast "ObjectDescription"
  13.   set TextoObjectDescription to the text of cast ObjectDescriptionCast
  14.   set theMap to TMap(mnew, theName, value(line 2 of TextoObjectDescription), value(line 3 of TextoObjectDescription), value(line 4 of TextoObjectDescription))
  15.   set fMap to theMap
  16.   set n to the number of cast ("InitObject" & gIdiom)
  17.   if n <> -1 then
  18.     sound playFile 2, "@:ANAL_AU:SHOWINFO"
  19.     SetCast(gConsoleText, n)
  20.     updateStage()
  21.   end if
  22.   set tiempo to the ticks
  23.   set numDuda to value(line 5 of TextoObjectDescription)
  24.   set fDudaList to InitList(numDuda)
  25.   ShuffleList(fDudaList)
  26.   set fNextDuda to 1
  27.   set numData to value(line 6 of TextoObjectDescription)
  28.   set fDataList to InitList(numData)
  29.   ShuffleList(fDataList)
  30.   set fNextData to 1
  31.   set tiempo to the ticks
  32.   set numSubsys to value(line 8 of TextoObjectDescription)
  33.   set princInfoOffset to 10 + numSubsys
  34.   set numPhysPrinc to value(line princInfoOffset of TextoObjectDescription)
  35.   set princList to []
  36.   repeat with i = 1 to numPhysPrinc
  37.     set thePrinc to line princInfoOffset + i of TextoObjectDescription
  38.     append(princList, thePrinc)
  39.   end repeat
  40.   set fPrinc to TPopup(mnew, princList, gPopupBaseSprite, "PrincMenu" & gIdiom, "PopupHilite", 25, 150, 5)
  41.   set invOffset to princInfoOffset + numPhysPrinc + 2
  42.   set numInventors to value(line invOffset of TextoObjectDescription)
  43.   set fInv to []
  44.   set fInvOffset to []
  45.   repeat with i = 1 to numInventors
  46.     set invName to line invOffset + (i * 2) - 1 of TextoObjectDescription
  47.     append(fInv, invName)
  48.     set itsOffset to value(line invOffset + (i * 2) of TextoObjectDescription)
  49.     append(fInvOffset, itsOffset)
  50.   end repeat
  51.   set fSubsys to []
  52.   set FlagOffset to invOffset + (numInventors * 2) + 2
  53.   set fSusSubsistemsFlag to value(line FlagOffset of TextoObjectDescription)
  54.  
  55. method mLinkMap
  56.   fMap(mSetItsObject, me)
  57.  
  58. method mGetSubSubsisFlag
  59.   return fSusSubsistemsFlag
  60.  
  61. method mInitializeSubsystems
  62.   global gIdiom
  63.   set subsysInfoOffset to 8
  64.   set ObjectDescriptionCast to the number of cast "ObjectDescription"
  65.   set numSubsys to value(line subsysInfoOffset of the text of cast ObjectDescriptionCast)
  66.   repeat with i = 1 to numSubsys
  67.     set n to the number of cast ("InitSubsys" & i & gIdiom)
  68.     if n <> -1 then
  69.       sound playFile 2, "@:ANAL_AU:SHOWINFO"
  70.       SetCast(gConsoleText, n)
  71.       updateStage()
  72.     end if
  73.     set subsysName to line subsysInfoOffset + i of the text of cast ObjectDescriptionCast
  74.     set theSubsys to TSubsys(mnew, subsysName, EMPTY, me)
  75.     theSubsys(mLinkMap)
  76.     append(fSubsys, theSubsys)
  77.   end repeat
  78.  
  79. method mGetSubsys i
  80.   if i <= count(fSubsys) then
  81.     return getAt(fSubsys, i)
  82.   else
  83.     return EMPTY
  84.   end if
  85.  
  86. method mGetDudaList
  87.   return fDudaList
  88.  
  89. method mGetDataList
  90.   return fDataList
  91.  
  92. method mGetNextDuda
  93.   set n to count(fDudaList)
  94.   if fNextDuda = n then
  95.     set r to getAt(fDudaList, n)
  96.     ShuffleList(fDudaList)
  97.     set fNextDuda to 1
  98.   else
  99.     set r to getAt(fDudaList, fNextDuda)
  100.     set fNextDuda to fNextDuda + 1
  101.   end if
  102.   return r
  103.  
  104. method mGetNextData
  105.   set n to count(fDataList)
  106.   if fNextData = n then
  107.     set r to getAt(fDataList, n)
  108.     ShuffleList(fDataList)
  109.     set fNextData to 1
  110.   else
  111.     set r to getAt(fDataList, fNextData)
  112.     set fNextData to fNextData + 1
  113.   end if
  114.   return r
  115.  
  116. method mGetPrincPopup
  117.   return fPrinc
  118.  
  119. method mGetInventorSection theName
  120.   set n to count(fInv)
  121.   repeat with i = 1 to n
  122.     if getAt(fInv, i) = theName then
  123.       set r to getAt(fInvOffset, i)
  124.       exit repeat
  125.     end if
  126.   end repeat
  127.   return r
  128.  
  129. method mShow
  130.   put "OBJECT: " & fName
  131.   put "DUDA list: " & fDudaList
  132.   put "DATA list: " & fDataList
  133.   put "SUBSYSTEMS: "
  134.   set n to count(fSubsys)
  135.   repeat with i = 1 to n
  136.     set theSubsys to getAt(fSubsys, i)
  137.     theSubsys(mShow)
  138.   end repeat
  139.  
  140. method mGetName
  141.   return fName
  142.  
  143. method mGetMap
  144.   return fMap
  145.  
  146. method mGetNumberOfSubsys
  147.   return count(fSubsys)
  148.  
  149. method mFree
  150.   if objectp(fMap) then
  151.     set theMap to fMap
  152.     set fMap to EMPTY
  153.     theMap(mFree)
  154.     theMap(mdispose)
  155.   end if
  156.   set numSubsys to count(fSubsys)
  157.   repeat with i = 1 to numSubsys
  158.     set theSubsys to getAt(fSubsys, 1)
  159.     deleteAt(fSubsys, 1)
  160.     theSubsys(mFree)
  161.     theSubsys(mdispose)
  162.   end repeat
  163.   if objectp(fPrinc) then
  164.     set thePopup to fPrinc
  165.     set fPrinc to EMPTY
  166.     thePopup(mdispose)
  167.   end if
  168.