/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 9)
/******************************************************************************/
(use "Controls")
(use "Cycle")
(use "Door")
(use "Feature")
(use "Game")
(use "Inv")
(use "Main")
(use "Obj")
/******************************************************************************/
(local
	leavetax
)
(instance public rm009 of Rm
	(properties
		picture scriptNumber
		north 0
		east 0
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))
		
		(switch(gPreviousRoomNumber)
			(default
				(send gEgo:
					posn(150 130)
					loop(1)
				)
			)
		)
		(if(== cancer 1)
			(Eks:init())
		)
		Display(
    @withheld
    dsCOORD 284 3
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
			   	Display(
    @eic
    dsCOORD 284 11
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
			   Display(
    @combat
    dsCOORD 252 19
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
			   Display(
    @linenine
    dsCOORD 284 27
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
			   Display(
    @plaintax
    dsCOORD 284 41
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
			   Display(
    @lineeleven
    dsCOORD 293 57
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
		SetUpEgo()
	
	)
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)

	(method (doit)
		(super:doit())
		// code executed each game cycle
	)

	(method (handleEvent pEvent)
		(var dyingScript)
		(super:handleEvent(pEvent))
		 (if (== evMOUSEBUTTON (send pEvent:type))
		(if(== $0020 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
          	(send gRoom:newRoom(7))
		) 
		(if(== $1000 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
			= cancer 1
			(Eks:init())
		)
		  (if(== $0002 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
	      	   			   	   		
	      	   		
	     		   		
	  		EditPrint(@withheld 14 "Withheld federal income tax:" #at 100 32 )
	  	Display(
    @withheld
    dsCOORD 284 3
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
		  )
		  (if(== $0004 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
		  	EditPrint(@eic 14 "Your Earned Income Credit:" #at 100 42 )
	  	Display(
    @eic
    dsCOORD 284 11
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
		  )
		  (if(== $0008 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
		  	EditPrint(@combat 14 "Non-taxable combat pay election:" #at 100 52 )
	  	Display(
    @combat
    dsCOORD 252 19
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
		  )
		  	  (if(== $0010 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
		  	EditPrint(@linenine 14 "Add lines 7 and 8a:" #at 100 62 )
	  	Display(
    @linenine
    dsCOORD 284 27
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
		  )
		  (if(== $2000 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
		  	EditPrint(@plaintax 14 "Your tax:" #at 100 62 )
	  	Display(
    @plaintax
    dsCOORD 284 41
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
		  )
		  (if(== $0040 OnControl(ocSPECIAL (send pEvent:x) (send pEvent:y)))
		  	EditPrint(@lineeleven 14 "If line 9 is larger than line 10, subtract line 10 from line 9:" #at 100 60 )
	  	Display(
    @lineeleven
    dsCOORD 293 57
    dsCOLOR clRED
    dsBACKGROUND -1
    dsFONT 4
    dsALIGN alLEFT
    dsWIDTH 200
			   )
		  )
		// handle Said's, etc...
		 )
		 (if(Said('leave, finish, exit, stop'))
					(while(1)
  					= leavetax Print(
  						"Would you like to make your changes permanent?"
  						#title "R U Dun 4 Gud?"
  						#font gDeadFont
  						#button "Nes"  1
  						#button "Yo"  2
  						
  					)
  					(switch(leavetax)
  						(case 1
  						= duntaxes 1
  						= gNormalCursor 152
			(send gGame:setCursor(gNormalCursor SET_CURSOR_VISIBLE 304 174))
  						Print("You stuff the form into its pre-addressed envelope and wrestle the flap closed.")
  						(send gEgo:get(INV_ENVELOPE))
  						(if((== STRINGS_EQUAL StrCmp("name" @lastname)) and (== STRINGS_EQUAL StrCmp("given" @firstname)) and (== STRINGS_EQUAL StrCmp("50" @withheld)))
				(send gGame:changeScore(3))
						)
						(if(== cancer 1)
							Print("Palming the parcel with one gargantuan hand, you make room in your inventory.")  
						)
			
  						(send gRoom:newRoom(4))
  						return
						)
					
		    			(case 2
		    			= withheld 0
		    			= eic 0
		    			= combat 0
		    			= linenine 0
		    			= plaintax 0
		    			= lineeleven 0
		    			= cancer 0
	 = gNormalCursor 152
			(send gGame:setCursor(gNormalCursor SET_CURSOR_VISIBLE 304 174))
	
  						(send gRoom:newRoom(4))
  						return
		    			)
		    		
					)
					)
				)
	)

	(method (changeState newState)
		(= state newState)
		(switch (newState)
			(case 0
				// Handle state changes
			)
		)
	)
)
/******************************************************************************/
(instance Eks of Prop
	(properties
		x 297
		y 110
		view 115
		loop 0
		priority 14
	)
)