예제 #1
0
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Punch)
{
	PARAM_ACTION_PROLOGUE;
	PARAM_INT(mult);

	MarinePunch(self, mult);
	return 0;
}
예제 #2
0
DEFINE_ACTION_FUNCTION(FSavegameManager, DoSave)
{
	PARAM_SELF_STRUCT_PROLOGUE(FSavegameManager);
	PARAM_INT(sel);
	PARAM_STRING(name);
	self->DoSave(sel, name);
	return 0;
}
예제 #3
0
파일: dynarrays.cpp 프로젝트: Blzut3/gzdoom
DEFINE_ACTION_FUNCTION(FDynArray_Ptr, Resize)
{
	PARAM_DYNARRAY_SIZE_PROLOGUE(FDynArray_Ptr);
	PARAM_INT(count);
	self->Resize(count);
	DYNARRAY_FILL_ITEMS_SKIP(0);
	return 0;
}
예제 #4
0
파일: dynarrays.cpp 프로젝트: Blzut3/gzdoom
DEFINE_ACTION_FUNCTION(FDynArray_Obj, Delete)
{
	PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj);
	PARAM_INT(index);
	PARAM_INT_DEF(count);
	self->Delete(index, count);
	return 0;
}
예제 #5
0
파일: w_wad.cpp 프로젝트: emileb/gzdoom
DEFINE_ACTION_FUNCTION(_Wads, CheckNumForName)
{
	PARAM_PROLOGUE;
	PARAM_STRING(name);
	PARAM_INT(ns);
	PARAM_INT_DEF(wadnum);
	PARAM_BOOL_DEF(exact);
	ACTION_RETURN_INT(Wads.CheckNumForName(name, ns, wadnum, exact));
}
예제 #6
0
파일: p_pspr.cpp 프로젝트: coelckers/gzdoom
DEFINE_ACTION_FUNCTION(_PlayerInfo, SetPSprite)	// the underscore is needed to get past the name mangler which removes the first clas name character to match the class representation (needs to be fixed in a later commit)
{
	PARAM_SELF_STRUCT_PROLOGUE(player_t);
	PARAM_INT(id);
	PARAM_POINTER(state, FState);
	PARAM_BOOL(pending);
	P_SetPsprite(self, (PSPLayers)id, state, pending);
	return 0;
}
예제 #7
0
파일: dynarrays.cpp 프로젝트: Blzut3/gzdoom
DEFINE_ACTION_FUNCTION(FDynArray_F64, Insert)
{
	PARAM_DYNARRAY_SIZE_PROLOGUE(FDynArray_F64);
	PARAM_INT(index);
	PARAM_FLOAT(val);
	self->Insert(index, val);
	DYNARRAY_FILL_ITEMS_SKIP(1);
	return 0;
}
예제 #8
0
파일: dynarrays.cpp 프로젝트: Blzut3/gzdoom
DEFINE_ACTION_FUNCTION(FDynArray_Ptr, Insert)
{
	PARAM_DYNARRAY_SIZE_PROLOGUE(FDynArray_Ptr);
	PARAM_INT(index);
	PARAM_POINTER(val, void);
	self->Insert(index, val);
	DYNARRAY_FILL_ITEMS_SKIP(1);
	return 0;
}
예제 #9
0
DEFINE_ACTION_FUNCTION(AActor, Teleport)
{
	PARAM_SELF_PROLOGUE(AActor);
	PARAM_FLOAT(x);
	PARAM_FLOAT(y);
	PARAM_FLOAT(z);
	PARAM_ANGLE(an);
	PARAM_INT(flags);
	ACTION_RETURN_BOOL(P_Teleport(self, DVector3(x, y, z), an, flags));
}
예제 #10
0
파일: dynarrays.cpp 프로젝트: Blzut3/gzdoom
DEFINE_ACTION_FUNCTION(FDynArray_Obj, Insert)
{
	PARAM_DYNARRAY_SIZE_PROLOGUE(FDynArray_Obj);
	PARAM_INT(index);
	PARAM_OBJECT(val, DObject);
	GC::WriteBarrier(val);
	self->Insert(index, val);
	DYNARRAY_FILL_ITEMS_SKIP(1);
	return 0;
}
예제 #11
0
DEFINE_ACTION_FUNCTION_PARAMS(AWeapon, A_SetCrosshair)
{
	PARAM_ACTION_PROLOGUE;
	PARAM_INT(xhair);

	if (self->player != NULL && self->player->ReadyWeapon != NULL)
	{
		self->player->ReadyWeapon->Crosshair = xhair;
	}
	return 0;
}
예제 #12
0
DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Light)
{
	PARAM_ACTION_PROLOGUE;
	PARAM_INT(light);

	if (self->player != NULL)
	{
		self->player->extralight = clamp<int>(light, -20, 20);
	}
	return 0;
}
예제 #13
0
DEFINE_ACTION_FUNCTION(AActor, A_OverlayFlags)
{
	PARAM_ACTION_PROLOGUE;
	PARAM_INT(layer);
	PARAM_INT(flags);
	PARAM_BOOL(set);

	if (!ACTION_CALL_FROM_PSPRITE())
		return 0;

	DPSprite *pspr = self->player->FindPSprite(((layer != 0) ? layer : stateinfo->mPSPIndex));

	if (pspr == nullptr)
		return 0;

	if (set)
		pspr->Flags |= flags;
	else
		pspr->Flags &= ~flags;

	return 0;
}
예제 #14
0
DEFINE_ACTION_FUNCTION(DFloor, CreateFloor)
{
	PARAM_PROLOGUE;
	PARAM_POINTER_NOT_NULL(sec, sector_t);
	PARAM_INT(floortype);
	PARAM_POINTER(ln, line_t);
	PARAM_FLOAT(speed);
	PARAM_FLOAT_DEF(height);
	PARAM_INT_DEF(crush);
	PARAM_INT_DEF(change);
	PARAM_BOOL_DEF(hereticlower);
	PARAM_BOOL_DEF(hexencrush);
	ACTION_RETURN_BOOL(P_CreateFloor(sec, (DFloor::EFloor)floortype, ln, speed, height, crush, change, hexencrush, hereticlower));
}
예제 #15
0
DEFINE_ACTION_FUNCTION(DCeiling, CreateCeiling)
{
	PARAM_PROLOGUE;
	PARAM_POINTER_NOT_NULL(sec, sector_t);
	PARAM_INT(type);
	PARAM_POINTER(ln, line_t);
	PARAM_FLOAT(speed);
	PARAM_FLOAT(speed2);
	PARAM_FLOAT_DEF(height);
	PARAM_INT_DEF(crush);
	PARAM_INT_DEF(silent);
	PARAM_INT_DEF(change);
	PARAM_INT_DEF(crushmode);
	ACTION_RETURN_BOOL(P_CreateCeiling(sec, (DCeiling::ECeiling)type, ln, 0, speed, speed2, height, crush, silent, change, (DCeiling::ECrushMode)crushmode));
}
예제 #16
0
/**
 * Handle a call to close() made by JavaScript.
 *
 * close expects 1 parameters:
 *   0: The socket file descriptor to close.
 * on success, close returns a result in |output|:
 *   0: "close"
 *   1: The socket file descriptor closed.
 * on failure, close returns an error string in |out_error|.
 */
int HandleClose(struct PP_Var params,
                struct PP_Var* output,
                const char** out_error) {
  CHECK_PARAM_COUNT(close, 1);
  PARAM_INT(0, sock);

  int result = close(sock);
  if (result != 0) {
    *out_error = PrintfToNewString("close returned error: %d", errno);
    return 1;
  }

  CREATE_RESPONSE(close);
  RESPONSE_INT(sock);
  return 0;
}
예제 #17
0
/**
 * Handle a call to send() made by JavaScript.
 *
 * send expects 2 parameters:
 *   0: The socket file descriptor to send using.
 *   1: The NULL terminated string to send.
 * on success, send returns a result in |output|:
 *   0: "send"
 *   1: The number of bytes sent.
 * on failure, send returns an error string in |out_error|.
 */
int HandleSend(struct PP_Var params,
               struct PP_Var* output,
               const char** out_error) {
  CHECK_PARAM_COUNT(send, 2);
  PARAM_INT(0, sock);
  PARAM_STRING(1, buffer);

  int result = (int32_t)send(sock, buffer, strlen(buffer), 0);
  if (result <= 0) {
    *out_error = PrintfToNewString("send failed: %s", strerror(errno));
    return 1;
  }

  CREATE_RESPONSE(send);
  RESPONSE_INT(result);
  return 0;
}
예제 #18
0
/**
 * Handle a call to mkdir() made by JavaScript.
 *
 * mkdir expects 1 parameter:
 *   0: The name of the directory
 *   1: The mode to use for the new directory, in octal.
 * on success, mkdir returns a result in |output|:
 *   0: "mkdir"
 *   1: the name of the directory
 * on failure, mkdir returns an error string in |out_error|.
 */
int HandleMkdir(struct PP_Var params,
                struct PP_Var* output,
                const char** out_error) {
  CHECK_PARAM_COUNT(mkdir, 2);
  PARAM_STRING(0, dirname);
  PARAM_INT(1, mode);

  int result = mkdir(dirname, mode);

  if (result != 0) {
    *out_error = PrintfToNewString("mkdir returned error: %d", errno);
    return 1;
  }

  CREATE_RESPONSE(mkdir);
  RESPONSE_STRING(dirname);
  return 0;
}
예제 #19
0
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Overlay)
{
	PARAM_ACTION_PROLOGUE;
	PARAM_INT		(layer);
	PARAM_STATE_OPT	(state) { state = nullptr; }
	PARAM_BOOL_OPT	(dontoverride)	{ dontoverride = false; }

	player_t *player = self->player;

	if (player == nullptr || (dontoverride && (player->FindPSprite(layer) != nullptr)))
	{
		ACTION_RETURN_BOOL(false);
	}

	DPSprite *pspr;
	pspr = new DPSprite(player, stateowner, layer);
	pspr->SetState(state);
	ACTION_RETURN_BOOL(true);
}
예제 #20
0
/**
 * Handle a call to connect() made by JavaScript.
 *
 * connect expects 2 parameters:
 *   0: The hostname to connect to.
 *   1: The port number to connect to.
 * on success, connect returns a result in |output|:
 *   0: "connect"
 *   1: The socket file descriptor.
 * on failure, connect returns an error string in |out_error|.
 */
int HandleConnect(struct PP_Var params,
                  struct PP_Var* output,
                  const char** out_error) {
  CHECK_PARAM_COUNT(connect, 2);
  PARAM_STRING(0, hostname);
  PARAM_INT(1, port);

  // Lookup host
  struct hostent* hostent = gethostbyname(hostname);
  if (hostent == NULL) {
    *out_error = PrintfToNewString("gethostbyname() returned error: %d", errno);
    return 1;
  }

  struct sockaddr_in addr;
  socklen_t addrlen = sizeof(addr);
  addr.sin_family = AF_INET;
  addr.sin_port = htons(port);
  memcpy(&addr.sin_addr.s_addr, hostent->h_addr_list[0], hostent->h_length);

  int sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock < 0) {
    *out_error = PrintfToNewString("socket() failed: %s", strerror(errno));
    return 1;
  }

  int result = connect(sock, (struct sockaddr*)&addr, addrlen);
  if (result != 0) {
    *out_error = PrintfToNewString("connect() failed: %s", strerror(errno));
    close(sock);
    return 1;
  }

  CREATE_RESPONSE(connect);
  RESPONSE_INT(sock);
  return 0;
}
예제 #21
0
/**
 * Handle a call to fread() made by JavaScript.
 *
 * fread expects 2 parameters:
 *   0: The index of the file (which is mapped to a FILE*)
 *   1: The number of bytes to read from the file.
 * on success, fread returns a result in |output|:
 *   0: "fread"
 *   1: the file index
 *   2: the data read from the file
 * on failure, fread returns an error string in |out_error|.
 */
int HandleFread(struct PP_Var params,
                struct PP_Var* output,
                const char** out_error) {
  CHECK_PARAM_COUNT(fread, 2);
  PARAM_FILE(0, file);
  PARAM_INT(1, data_len);

  char* buffer = (char*)malloc(data_len + 1);
  size_t bytes_read = fread(buffer, 1, data_len, file);
  buffer[bytes_read] = 0;

  if (ferror(file)) {
    *out_error = PrintfToNewString(
        "Read %" PRIuS " bytes, but ferror() returns true", bytes_read);
    free(buffer);
    return 1;
  }

  CREATE_RESPONSE(fread);
  RESPONSE_INT(file_index);
  RESPONSE_STRING(buffer);
  free(buffer);
  return 0;
}
예제 #22
0
파일: dynarrays.cpp 프로젝트: Blzut3/gzdoom
DEFINE_ACTION_FUNCTION(FDynArray_I8, Push)
{
	PARAM_SELF_STRUCT_PROLOGUE(FDynArray_I8);
	PARAM_INT(val);
	ACTION_RETURN_INT(self->Push(val));
}
예제 #23
0
파일: dynarrays.cpp 프로젝트: Blzut3/gzdoom
DEFINE_ACTION_FUNCTION(FDynArray_String, Reserve)
{
	PARAM_SELF_STRUCT_PROLOGUE(FDynArray_String);
	PARAM_INT(count);
	ACTION_RETURN_INT(self->Reserve(count));
}
예제 #24
0
DEFINE_ACTION_FUNCTION(FSavegameManager, ExtractSaveData)
{
	PARAM_SELF_STRUCT_PROLOGUE(FSavegameManager);
	PARAM_INT(sel);
	ACTION_RETURN_INT(self->ExtractSaveData(sel));
}
예제 #25
0
파일: dynarrays.cpp 프로젝트: Blzut3/gzdoom
DEFINE_ACTION_FUNCTION(FDynArray_I32, Find)
{
	PARAM_SELF_STRUCT_PROLOGUE(FDynArray_I32);
	PARAM_INT(val);
	ACTION_RETURN_INT(self->Find(val));
}
예제 #26
0
파일: p_pspr.cpp 프로젝트: coelckers/gzdoom
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetPSprite)	// the underscore is needed to get past the name mangler which removes the first clas name character to match the class representation (needs to be fixed in a later commit)
{
	PARAM_SELF_STRUCT_PROLOGUE(player_t);
	PARAM_INT(id);
	ACTION_RETURN_OBJECT(self->GetPSprite((PSPLayers)id));
}
예제 #27
0
DEFINE_ACTION_FUNCTION(FSavegameManager, GetSavegame)
{
	PARAM_SELF_STRUCT_PROLOGUE(FSavegameManager);
	PARAM_INT(i);
	ACTION_RETURN_POINTER(self->GetSavegame(i));
}
예제 #28
0
        delete[] (int *)GDCPIE_Color;
    if (GDCPIE_missing)
        delete[] (bool *)GDCPIE_missing;
    if (GDC_ExtVolColor)
        delete[] (int *)GDC_ExtVolColor;
    if (GDC_SetColor)
        delete[] (int *)GDC_SetColor;
    if (GDC_ExtColor)
        delete[] (int *)GDC_ExtColor;

    return 0;
}
//-----------------------------------------------------//
CONCEPT_FUNCTION_IMPL(_GDCPIE_BGColor, 1)
    T_NUMBER(_GDCPIE_BGColor, 0)
    RETURN_NUMBER(GDCPIE_BGColor = PARAM_INT(0));
END_IMPL
//-----------------------------------------------------//
CONCEPT_FUNCTION_IMPL(_GDCPIE_PlotColor, 1)
    T_NUMBER(_GDCPIE_PlotColor, 0)
    RETURN_NUMBER(GDCPIE_PlotColor = PARAM_INT(0));
END_IMPL
//-----------------------------------------------------//
CONCEPT_FUNCTION_IMPL(_GDCPIE_LineColor, 1)
    T_NUMBER(_GDCPIE_LineColor, 0)
    RETURN_NUMBER(GDCPIE_LineColor = PARAM_INT(0));
END_IMPL
//-----------------------------------------------------//
CONCEPT_FUNCTION_IMPL(_GDCPIE_EdgeColor, 1)
    T_NUMBER(_GDCPIE_EdgeColor, 0)
    RETURN_NUMBER(GDCPIE_EdgeColor = PARAM_INT(0));
예제 #29
0
struct psc_es1 {
  // parameters
  double om_pe;
  double om_ce;
  struct psc_es1_species species[MAX_KINDS];
};

#define to_psc_es1(psc) mrc_to_subobj(psc, struct psc_es1)

#define VAR(x) (void *)offsetof(struct psc_es1, x)
static struct param psc_es1_descr[] = {
  { "om_pe"         , VAR(om_pe)            , PARAM_DOUBLE(1.)            },
  { "om_ce"         , VAR(om_ce)            , PARAM_DOUBLE(2.)            },

  { "nlg_1"         , VAR(species[0].nlg)   , PARAM_INT(1)                },
  { "q_1"           , VAR(species[0].q)     , PARAM_DOUBLE(-1.)           },
  { "m_1"           , VAR(species[0].m)     , PARAM_DOUBLE(1.)            },
  { "mode_1"        , VAR(species[0].mode)  , PARAM_DOUBLE(1.)            },
  { "v0_1"          , VAR(species[0].v0)    , PARAM_DOUBLE(0.)            },
  { "x1_1"          , VAR(species[0].x1)    , PARAM_DOUBLE(.001)          },
  { "v1_1"          , VAR(species[0].v1)    , PARAM_DOUBLE(0.)            },
  { "thetax_1"      , VAR(species[0].thetax), PARAM_DOUBLE(0.)            },
  { "thetav_1"      , VAR(species[0].thetav), PARAM_DOUBLE(0.)            },

  { "nlg_2"         , VAR(species[1].nlg)   , PARAM_INT(1)                },
  { "q_2"           , VAR(species[1].q)     , PARAM_DOUBLE(-1.)           },
  { "m_2"           , VAR(species[1].m)     , PARAM_DOUBLE(1.)            },
  { "mode_2"        , VAR(species[1].mode)  , PARAM_DOUBLE(1.)            },
  { "v0_2"          , VAR(species[1].v0)    , PARAM_DOUBLE(0.)            },
  { "x1_2"          , VAR(species[1].x1)    , PARAM_DOUBLE(.001)          },
예제 #30
0
void CameraDriver::ReconfigureCallback(UVCCameraConfig &new_config, uint32_t level) {
  boost::recursive_mutex::scoped_lock(mutex_);

  if ((level & kReconfigureClose) == kReconfigureClose) {
    if (state_ == kRunning)
      CloseCamera();
  }

  if (state_ == kStopped) {
    OpenCamera(new_config);
  }

  if (new_config.camera_info_url != config_.camera_info_url)
    cinfo_manager_.loadCameraInfo(new_config.camera_info_url);

  if (state_ == kRunning) {
#define PARAM_INT(name, fn, value) if (new_config.name != config_.name) { \
      int val = (value);                                                \
      if (uvc_set_##fn(devh_, val)) {                                   \
        ROS_WARN("Unable to set " #name " to %d", val);                 \
        new_config.name = config_.name;                                 \
      }                                                                 \
    }

    PARAM_INT(scanning_mode, scanning_mode, new_config.scanning_mode);
    PARAM_INT(auto_exposure, ae_mode, 1 << new_config.auto_exposure);
    PARAM_INT(auto_exposure_priority, ae_priority, new_config.auto_exposure_priority);
    PARAM_INT(exposure_absolute, exposure_abs, new_config.exposure_absolute * 10000);
    PARAM_INT(auto_focus, focus_auto, new_config.auto_focus ? 1 : 0);
    PARAM_INT(focus_absolute, focus_abs, new_config.focus_absolute);
#if libuvc_VERSION     > 00005 /* version > 0.0.5 */
    PARAM_INT(gain, gain, new_config.gain);
    PARAM_INT(iris_absolute, iris_abs, new_config.iris_absolute);
    PARAM_INT(brightness, brightness, new_config.brightness);
#endif
    

    if (new_config.pan_absolute != config_.pan_absolute || new_config.tilt_absolute != config_.tilt_absolute) {
      if (uvc_set_pantilt_abs(devh_, new_config.pan_absolute, new_config.tilt_absolute)) {
        ROS_WARN("Unable to set pantilt to %d, %d", new_config.pan_absolute, new_config.tilt_absolute);
        new_config.pan_absolute = config_.pan_absolute;
        new_config.tilt_absolute = config_.tilt_absolute;
      }
    }
    // TODO: roll_absolute
    // TODO: privacy
    // TODO: backlight_compensation
    // TODO: contrast
    // TODO: power_line_frequency
    // TODO: auto_hue
    // TODO: saturation
    // TODO: sharpness
    // TODO: gamma
    // TODO: auto_white_balance
    // TODO: white_balance_temperature
    // TODO: white_balance_BU
    // TODO: white_balance_RV
  }

  config_ = new_config;
}