//Incremental update for TobEx beta 0021

//Expanded Actions
APPEND "action.ids" "353 DialogueSetGlobal(S:Name*,S:Area*,I:Value*)" UNLESS "353 DialogueSetGlobal(S:Name*,S:Area*,I:Value*)"
APPEND "action.ids" "354 DialogueIncrementGlobal(S:Name*,S:Area*,I:Value*)" UNLESS "354 DialogueIncrementGlobal(S:Name*,S:Area*,I:Value*)"
APPEND "action.ids" "355 DialogueSG(S:Name*,I:Num*)" UNLESS "355 DialogueSG(S:Name*,I:Num*)"

//Sex fixes - taken from BG2 Fixpack v9
// sex fixes
COPY_EXISTING ~bazliz01.cre~ ~override~
              ~bazliz02.cre~ ~override~
              ~c6gofus.cre~  ~override~
              ~c6kach.cre~   ~override~
              ~cowenf1.cre~  ~override~
              ~cscleric.cre~ ~override~
              ~derrick.cre~  ~override~
              ~dpmon01.cre~  ~override~
              ~drofod03.cre~ ~override~
              ~escort3.cre~  ~override~
              ~kaysmg01.cre~ ~override~
              ~kpsold10.cre~ ~override~
              ~kuoarc20.cre~ ~override~
              ~palern.cre~   ~override~
              ~palkni02.cre~ ~override~
              ~palkni04.cre~ ~override~
              ~palkni05.cre~ ~override~
              ~pcapt02.cre~  ~override~
              ~sarbha01.cre~ ~override~
              ~slvic02.cre~  ~override~
              ~tobpar04.cre~ ~override~
              ~trfued02.cre~ ~override~
              ~winnkeep.cre~ ~override~
              ~yarmy03.cre~  ~override~
  PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN // protects against invalid files
    WRITE_BYTE 0x0237 1 // male
  END
  BUT_ONLY_IF_IT_CHANGES

// more sex fixes
COPY_EXISTING ~amfem01.cre~  ~override~
              ~amfem02.cre~  ~override~
              ~amgirl01.cre~ ~override~
              ~ammonk08.cre~ ~override~
              ~ar18arch.cre~ ~override~
              ~c6catti.cre~  ~override~
              ~c6catti2.cre~ ~override~
              ~c6cler3.cre~  ~override~
              ~c6del.cre~    ~override~
              ~c6guen.cre~   ~override~
              ~c6guen2.cre~  ~override~
              ~cefald02.cre~ ~override~
              ~chickdef.cre~ ~override~
              ~chicke.cre~   ~override~
              ~chicker.cre~  ~override~
              ~cow.cre~      ~override~
              ~csheck3.cre~  ~override~
              ~cssupp2.cre~  ~override~
              ~deadcow1.cre~ ~override~
              ~deadcow2.cre~ ~override~
              ~deer01.cre~   ~override~
              ~devaevil.cre~ ~override~
              ~devast01.cre~ ~override~
              ~devmon01.cre~ ~override~
              ~dpfemale.cre~ ~override~
              ~dpstat05.cre~ ~override~
              ~drofod02.cre~ ~override~ // Drow, female mage (Wisp)
              ~drofod04.cre~ ~override~
              ~drow04.cre~   ~override~
              ~dsbody01.cre~ ~override~
              ~fangel01.cre~ ~override~
              ~finsol01.cre~ ~override~
              ~garkid01.cre~ ~override~
              ~gemch01.cre~  ~override~
              ~gemch02.cre~  ~override~
              ~gorsta05.cre~ ~override~
              ~hlshyr.cre~   ~override~
              ~hspectr1.cre~ ~override~
              ~jade1.cre~    ~override~
              ~jahei1.cre~   ~override~
              ~jarev1.cre~   ~override~
              ~mgkhol01.cre~ ~override~
              ~nchick.cre~   ~override~
              ~ncow.cre~     ~override~
              ~nymphsu.cre~  ~override~
              ~pirfsh02.cre~ ~override~
              ~pirsal02.cre~ ~override~
              ~planet01.cre~ ~override~
              ~planevil.cre~ ~override~
              ~plangood.cre~ ~override~
              ~planwish.cre~ ~override~
              ~ppmag01.cre~  ~override~
              ~sendai7.cre~  ~override~
              ~sleepfh.cre~  ~override~ // Sleeping Woman
              ~solar.cre~    ~override~
              ~solar01.cre~  ~override~
              ~suendel2.cre~ ~override~
              ~suendel4.cre~ ~override~
              ~suendel6.cre~ ~override~
              ~suendel8.cre~ ~override~
              ~tobpar02.cre~ ~override~
              ~trftow04.cre~ ~override~
              ~trskin01.cre~ ~override~
              ~uddoor06.cre~ ~override~
              ~uddrow35.cre~ ~override~
              ~vampaer.cre~  ~override~
              ~vampjah.cre~  ~override~
              ~vampvic.cre~  ~override~
              ~vvmadman.cre~ ~override~
              ~wpwench1.cre~ ~override~
              ~yarmy01.cre~  ~override~
              ~ysmage02.cre~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN // protects against invalid files
    WRITE_BYTE 0x0237 2 // female
  END
  BUT_ONLY_IF_IT_CHANGES

// yet more sex fixes
COPY_EXISTING ~statue01.cre~ ~override~
              ~statue02.cre~ ~override~
              ~statue03.cre~ ~override~
              ~statue04.cre~ ~override~
              ~statue05.cre~ ~override~
              ~statue06.cre~ ~override~
              ~sword01.cre~  ~override~
              ~sword02.cre~  ~override~
              ~sword03.cre~  ~override~
  PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN // protects against invalid files
    WRITE_BYTE 0x0237 3 // neither
  END
  BUT_ONLY_IF_IT_CHANGES

//pre-made character sex fixes (not in BG2 Fixpack)
ACTION_IF (FILE_EXISTS ~characters/MAGE.CHR~) BEGIN
  COPY ~characters/mage.chr~ ~characters/mage.chr~
    PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN // protects against invalid files
      WRITE_BYTE 0x029b 2 // female
    END
    BUT_ONLY_IF_IT_CHANGES
END

ACTION_IF (FILE_EXISTS ~characters/tobmage.chr~) BEGIN
  COPY ~characters/tobmage.chr~ ~characters/tobmage.chr~
    PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN // protects against invalid files
      WRITE_BYTE 0x029b 2 // female
    END
    BUT_ONLY_IF_IT_CHANGES
END

ACTION_IF (FILE_EXISTS ~characters/thief.chr~) BEGIN
  COPY ~characters/thief.chr~ ~characters/thief.chr~
    PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN // protects against invalid files
      WRITE_BYTE 0x029b 2 // female
    END
    BUT_ONLY_IF_IT_CHANGES
END

ACTION_IF (FILE_EXISTS ~characters/tobthief.chr~) BEGIN
  COPY ~characters/tobthief.chr~ ~characters/tobthief.chr~
    PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN // protects against invalid files
      WRITE_BYTE 0x029b 2 // female
    END
    BUT_ONLY_IF_IT_CHANGES
END
