/* move action by macfly august 2001 */ struct MoveAction = [ MOVEACTIONkey : I, /* key scancode */ MOVEACTIONcode : S, /* code */ MOVEACTIONpos : I /* pos code in moveevent list : for better performance */ ]mkMoveAction;; fun MOVEACTION_GetKeyId (moveaction, kbd) = if moveaction.MOVEACTIONkey < 0 then /* mouse */ strcatn (_loc this "PAINTBALL_MOUSE_BUTTON" nil)::" "::(itoa (-moveaction.MOVEACTIONkey))::nil else /* keyboard */ MOVEKBD_SearchByKey (nth_list MOVE_GetKeyboards kbd) moveaction.MOVEACTIONkey ;; fun MOVEACTION_GetScan (moveaction) = moveaction.MOVEACTIONkey ;; fun MOVEACTION_EltCompareKey (elt1, elt2) = elt1.MOVEACTIONkey - elt2.MOVEACTIONkey ;; fun MOVEACTION_CompareKey (elt, key) = elt.MOVEACTIONkey - key ;; fun MOVEACTION_CompareCode (elt, code) = !strcmpi elt.MOVEACTIONcode code ;; fun MOVEACTION_Create (scan, code, pos) = mkMoveAction [scan code pos] ;; /* Ajoute dans la liste les différents touches de configuration */ fun MOVEACTION_AddList (listEvent, listAction) = if listAction == nil then nil else let listAction -> [cur nextAction] in let cur -> [code [scan _]] in let MOVEEVENT_PosInList listEvent code -> pos in if pos == nil then MOVEACTION_AddList listEvent nextAction else (MOVEACTION_Create (atoi scan) code pos)::MOVEACTION_AddList listEvent nextAction ;; fun MOVEACTION_SearchByKey (listAction, key) = SearchSortedInList listAction @MOVEACTION_CompareKey key ;; fun MOVEACTION_GetMovement (listEvent, action, moveaction, type) = let nth_list listEvent moveaction.MOVEACTIONpos -> moveevent in let MOVEEVENT_GetMove moveevent -> movement in if movement == nil then nil else if action == nil then if type & MOVEEVENT_CONTINUE then let movement -> [[x y z] [a b c]] in [[(-x) (-y) (-z)] [(-a) (-b) (-c)]] else nil else if action then movement else nil ;; fun MOVEACTION_GetList (listaction) = if listaction == nil then nil else let listaction -> [cur next] in (cur.MOVEACTIONcode::(itoa cur.MOVEACTIONkey)::nil)::(MOVEACTION_GetList next) ;; fun MOVEACTION_Save (listaction) = _storepack strbuild MOVEACTION_GetList listaction "tmp/move/moveaction.cfg" ;; fun MOVEACTION_Init (listEvent) = let let _checkpack "tmp/move/moveaction.cfg" -> resultP in if resultP == nil then _checkpack strcat (PLUGpath thisplug) "move/moveaction.cfg" /* MODIF MOVE */ else resultP -> fileP in quicksort MOVEACTION_AddList listEvent (strextr _fooS _getpack fileP ) @MOVEACTION_EltCompareKey ;; fun MOVEACTION_RemoveFromKeyAndCode (listaction, key, code) = if listaction == nil then nil else let listaction -> [cur next] in if cur.MOVEACTIONkey == key && !strcmpi cur.MOVEACTIONcode code then next else if cur.MOVEACTIONkey > key then listaction else cur::(MOVEACTION_RemoveFromKeyAndCode next key code) ;; fun MOVEACTION_Add (listaction, scan, code, pos) = if listaction == nil then (MOVEACTION_Create scan code pos)::nil else let listaction -> [cur next] in if cur.MOVEACTIONkey == scan then (MOVEACTION_Add next scan code pos) else if cur.MOVEACTIONkey > scan then (MOVEACTION_Create scan code pos)::listaction else cur::(MOVEACTION_Add next scan code pos) ;;