#pragma once

class point;
class CSplineSequence;
class CCinematicScript;
class cin_gce_import_t;
class cin_gce_export_t;

#include "ref.h"

//the latest version of the script save files.
#define SCRIPT_FILE_VERSION 3
//changes made for each version
//
//1 - Added sound array to CScriptShot
//2 - Added entity array to CScriptShot
//3 - Added entity name fields for camera target and shot completion data to CScriptShot



//this structure is used to export functions from the exe to gce.dll
//we keep this structure separate so that we do not have to have our
//types included where the rest of the files would need to include
//our header files.

class cin_gce_export_t {
  public:
    //returns a version number
    int (*GCE_Version)();

    //gives the exe the import structure with function that can be called in gce.dll
    void (*GCE_Import)(cin_gce_import_t &import);

    //gets the last position and angles of the camera.
    void (*LastCameraPos)(point &pos, point &angles);

    //the playback module in the exe will copy the given script and use
    //it in subsequent playback operations.
    void (*UpdateScript)(CCinematicScript &sequence);

    //draws text on the screen
    void (*DrawString)(int x, int y, const char *str);

    //adds an entity to the client's entity list.
    void (*V_AddEntity)(entity_t *ent);

    refexport_t *(*GetRefExport)();

    //loads a script, using the pack file routines.  The returned script
    //should not be modified in any way in the dll, and should be passed to 
    //DeleteScript when it is no longer needed.
    const CCinematicScript *(*LoadScript)(const char *name);
    void (*DeleteScript)(const CCinematicScript *script);

    //computes vectors that correspond to the given angles.
    void (*AngleVectors)(point &angles, point &forward, point &right, point &up);

    //for accessing information about entities.
    bool (*EntityPosition)(const char *entity_name, point &location, point &angles);

    //for moving a monster type entity.
    void (*TeleportEntity)(const char *entity_name, const point &location, const point &angles, bool use_angles);

};

//this structure is used by gce.dll to pass a set of function pointers back to the exe.
class cin_gce_import_t {
  public:
    cin_gce_import_t();

    //called after the world draws, lets the dll draw text and 2-d graphics to the screen.
    void (*GCE_HUD)();

    void (*AddEntities)();

    //returns 1 is we have a currently active edit field that wants our keyboard input.
    int (*InputActive)();

    //returns 1 if the dll made use of the keystroke.
    int (*InputKeyEvent)(int key);

    //returns 1 if the dll made use of the mouse movement info.
    int (*InputMouseMove)(int dx, int dy);

    //gives the dll a chance to control the camera position/angles.
    void (*SetCamera)(float *pos, float *angles);
};

