Ejemplo n.º 1
0
/**
 *	constructL method that creates the AppView object
 *	
 */  
void CTApp1Ui::ConstructL()
    {
    BaseConstructL();
	CWsScreenDevice * screen = CCoeEnv::Static()->ScreenDevice();
	TSize screenSize=screen->SizeInPixels();
	
	TInt posX = 0;
	READ_INT(KTApp1PositionX, KWServTApp1ConfigFile, posX);
	CalculateAbsL(posX, screenSize.iWidth);
	
	TInt posY = 0;
	READ_INT(KTApp1PositionY, KWServTApp1ConfigFile, posY);
	CalculateAbsL(posY, screenSize.iHeight);
	
	TInt width = 0;
	READ_INT(KTApp1Width, KWServTApp1ConfigFile, width);
	CalculateAbsL(width, screenSize.iWidth);
	
	TInt height = 0;
	READ_INT(KTApp1Height, KWServTApp1ConfigFile, height);
	CalculateAbsL(height, screenSize.iHeight);
	
    TRect myRect(TPoint(posX,posY), TPoint(width+posX,height+posY));
	iAppView = CTApp1View::NewL(myRect);
	}
Ejemplo n.º 2
0
//===============================================================================
void JamAndShootSkill::loadValues()
{
  ///Open the paramater file:
  ///REMEMBER TO CHANGE THE PARAMETER TEXT FILE NAME TO THE APPROPRIATE NAME!
  ifstream mainFile;
  mainFile.open("Params/Skill_Params/JamAndShootSkillParams.txt", ios::nocreate);
  
  ASSERT(mainFile.fail() == 0, "CAN'T OPEN PARAMETER FILE!");

  //Load parameter values.  See params.h and params.cpp for good examples.
  //################  ADD PARAMETERS BELOW ################  
  READ_FLOAT(WAIT_TIME);
  READ_FLOAT(DRIFT_ANGLE);
  READ_FLOAT(AIM_ANGLE);
  READ_FLOAT(RANDOM_ANGLE);
  READ_FLOAT(EDGE_ANGLE);
  READ_FLOAT(AIM_DISTANCE);
  READ_FLOAT(FINISHED_TIME);
  READ_FLOAT(VALID_ANGLE);
  READ_FLOAT(BOUNCE_ANGLE);
  READ_FLOAT(ENTERBOX_CAUTION_DIST);
  READ_FLOAT(SIDE_DIST);
  READ_FLOAT(SIDE_LANE_FACTOR);
  READ_FLOAT(DRIFT_ADJUST_ANGLE);
  READ_INT(PAUSE_FRAMES);
  READ_INT(PAUSE_RANDOM);
  //################  ADD PARAMETERS ABOVE ################
  mainFile.close();
  
}
Ejemplo n.º 3
0
static int createcurse_read(trigger * t, gamedata *data)
{
    createcurse_data *td = (createcurse_data *)t->data.v;
    char zText[128];
    float flt;

    read_reference(&td->mage, data, read_unit_reference, resolve_unit);
    read_reference(&td->target, data, read_unit_reference, resolve_unit);

    READ_TOK(data->store, zText, sizeof(zText));
    td->type = ct_find(zText);
    READ_FLT(data->store, &flt);
    td->vigour = flt;
    READ_INT(data->store, &td->duration);
    if (data->version < CURSEFLOAT_VERSION) {
        int n;
        READ_INT(data->store, &n);
        td->effect = (float)n;
    }
    else {
        READ_FLT(data->store, &flt);
        td->effect = flt;
    }
    READ_INT(data->store, &td->men);
    return AT_READ_OK;
}
Ejemplo n.º 4
0
void read_groups(struct storage *store, faction * f)
{
  for (;;) {
    ally **pa;
    group *g;
    int gid;
    char buf[1024];

    READ_INT(store, &gid);
    if (gid == 0)
      break;
    READ_STR(store, buf, sizeof(buf));
    g = new_group(f, buf, gid);
    pa = &g->allies;
    for (;;) {
      ally *a;
      variant fid;
      READ_INT(store, &fid.i);
      if (fid.i <= 0)
        break;
      if (global.data_version < STORAGE_VERSION && fid.i == 0)
        break;
      a = malloc(sizeof(ally));
      *pa = a;
      pa = &a->next;
      READ_INT(store, &a->status);

      a->faction = findfaction(fid.i);
      if (!a->faction)
        ur_add(fid, &a->faction, resolve_faction);
    }
    *pa = 0;
    a_read(store, &g->attribs, g);
  }
}
Ejemplo n.º 5
0
void ReadParameters(int *xlength, float *tau, float *velocity_wall, int *timesteps,
		int *timesteps_per_plotting, int argc, char *argv[], int *gpu_enabled, int *gpu_streaming,
        int *gpu_collision, int *gpu_boundaries){
    float *velocity_wall_1, *velocity_wall_2, *velocity_wall_3;
    
    if(argc<3) PrintHelpMessage();
    if(!strcmp(argv[1], "-help") || !strcmp(argv[2], "-help")) PrintHelpMessage();
    if(access(argv[1], R_OK) != 0)
        ERROR("Provided configuration file path either doesn't exist or can not be read.");
    
    if(!strcmp(argv[2], "-gpu")) *gpu_enabled=1; else *gpu_enabled=0;
    if(!strcmp(argv[2], "-gpu-streaming")) *gpu_streaming=1; else *gpu_streaming=0;
    if(!strcmp(argv[2], "-gpu-collision")) *gpu_collision=1; else *gpu_collision=0;
    if(!strcmp(argv[2], "-gpu-boundaries")) *gpu_boundaries=1; else *gpu_boundaries=0;

    READ_FLOAT(argv[1], *tau);

    velocity_wall_1=&velocity_wall[0];
    velocity_wall_2=&velocity_wall[1];
    velocity_wall_3=&velocity_wall[2];

    READ_FLOAT(argv[1], *velocity_wall_1);
    READ_FLOAT(argv[1], *velocity_wall_2);
    READ_FLOAT(argv[1], *velocity_wall_3);
    
    READ_INT(argv[1], *xlength);
    READ_INT(argv[1], *timesteps);
    READ_INT(argv[1], *timesteps_per_plotting);
}
Ejemplo n.º 6
0
/**
	requires MSG_DATA_REPLY -  reply for one piece:
		MSG_DATA_REPLY|piece_index|data_length|data

	@param msg Message to parse
	@param buf Memory to store data

	@return piece_index
*/
int messageParseDataReply(Message *msg, char *buf)
{
	assert(msg);
	assert(buf);

	messageDump(msg, "messageParseDataReply.txt");

	int piece_index = 0;
	int data_length = 0;
	int pos = 0;
	pos += 4;   // skip MessageType

	piece_index = READ_INT(msg->data + pos);
	verbose1("messageParseDataReply::piece_index = %d\n", piece_index);
	pos += 4;

	data_length = READ_INT(msg->data + pos);
	verbose1("messageParseDataReply::data_length = %d\n", data_length);
	pos += 4;

	memcpy(buf, msg->data + pos, data_length);
	pos += data_length;

	assert(pos == msg->length);

	return piece_index;
}
Ejemplo n.º 7
0
Archivo: loader.c Proyecto: rousya/ktap
static int load_debuginfo(struct load_state *S, ktap_proto *f)
{
	int i,n;

	f->source = READ_STRING(S);
	n = READ_INT(S);
	f->sizelineinfo = n;
	f->lineinfo = NEW_VECTOR(S, n * sizeof(int));
	READ_VECTOR(S, f->lineinfo, n * sizeof(int));
	n = READ_INT(S);
	f->locvars = NEW_VECTOR(S, n * sizeof(struct ktap_locvar));
	f->sizelocvars = n;
	for (i = 0; i < n; i++)
		f->locvars[i].varname = NULL;
	for (i = 0; i < n; i++) {
		f->locvars[i].varname = READ_STRING(S);
		f->locvars[i].startpc = READ_INT(S);
		f->locvars[i].endpc = READ_INT(S);
	}
	n = READ_INT(S);
	for (i = 0; i < n; i++)
		f->upvalues[i].name = READ_STRING(S);

	return 0;
}
Ejemplo n.º 8
0
void read_groups(struct storage *store, faction * f)
{
    for (;;) {
        ally **pa;
        group *g;
        int gid;
        char buf[1024];

        READ_INT(store, &gid);
        if (gid == 0)
            break;
        READ_STR(store, buf, sizeof(buf));
        g = new_group(f, buf, gid);
        pa = &g->allies;
        for (;;) {
            ally *a;
            variant fid;

            READ_INT(store, &fid.i);
            if (fid.i <= 0)
                break;
            a = ally_add(pa, findfaction(fid.i));
            READ_INT(store, &a->status);
            if (!a->faction)
                ur_add(fid, &a->faction, resolve_faction);
        }
        a_read(store, &g->attribs, g);
    }
}
Ejemplo n.º 9
0
static std::list<VersionedValue> * readResults(std::istream* inputStream) {
    std::list<VersionedValue>* responseList = 
        new std::list<VersionedValue>();

    try {
        uint32_t resultSize;
        READ_INT(inputStream, resultSize);

        for (uint32_t i = 0; i < resultSize; i++) {
            uint32_t valueSize;
            READ_INT(inputStream, valueSize);
            VectorClock* vc = NULL;
            std::string* value = NULL;
            int vcsize = 0;
            try {
                vc = readVectorClock(inputStream, vcsize);
                value = readBytes(inputStream, valueSize - vcsize);
            } catch (...) {
                if (vc) delete vc;
                if (value) delete value;
                throw;
            }
            VersionedValue vv(value, vc);
            responseList->push_back(vv);
        }
        return responseList;

    } catch (...) {
        if (responseList) delete responseList;
        throw;
    }
}
Ejemplo n.º 10
0
static void b_readroad(connection * b, storage * store)
{
  int n;
  READ_INT(store, &n);
  b->data.sa[0] = (short)n;
  READ_INT(store, &n);
  b->data.sa[1] = (short)n;
}
Ejemplo n.º 11
0
static int
a_readmuseumgivebackcookie(attrib * a, void *owner, gamedata *data)
{
    museumgivebackcookie *gbc = (museumgivebackcookie *)a->data.v;
    READ_INT(data->store, &gbc->warden_no);
    READ_INT(data->store, &gbc->cookie);
    return AT_READ_OK;
}
Ejemplo n.º 12
0
int read_parameters(
                    const char *szFileName,       /* name of the file */
                    double *Re,                /* reynolds number   */
                    double *UI,                /* velocity x-direction */
                    double *VI,                /* velocity y-direction */
                    double *PI,                /* pressure */
                    double *GX,                /* gravitation x-direction */
                    double *GY,                /* gravitation y-direction */
                    double *t_end,             /* end time */
                    double *xlength,           /* length of the domain x-dir.*/
                    double *ylength,           /* length of the domain y-dir.*/
                    double *dt,                /* time step */
                    double *dx,                /* length of a cell x-dir. */
                    double *dy,                /* length of a cell y-dir. */
                    int  *imax,                /* number of cells x-direction*/
                    int  *jmax,                /* number of cells y-direction*/
                    double *alpha,             /* uppwind differencing factor*/
                    double *omg,               /* relaxation factor */
                    double *tau,               /* safety factor for time step*/
                    int  *itermax,             /* max. number of iterations
                                                 for pressure per time step */
                    double *eps,               /* accuracy bound for pressure*/
                    double *dt_value,          /* time for output */
                    int *iproc,
                    int *jproc)
{
    READ_DOUBLE( szFileName, *xlength );
    READ_DOUBLE( szFileName, *ylength );
    
    READ_DOUBLE( szFileName, *Re    );
    READ_DOUBLE( szFileName, *t_end );
    READ_DOUBLE( szFileName, *dt    );
    
    READ_INT   ( szFileName, *imax );
    READ_INT   ( szFileName, *jmax );
    
    READ_DOUBLE( szFileName, *omg   );
    READ_DOUBLE( szFileName, *eps   );
    READ_DOUBLE( szFileName, *tau   );
    READ_DOUBLE( szFileName, *alpha );
    
    READ_INT   ( szFileName, *itermax );
    READ_DOUBLE( szFileName, *dt_value );
    
    READ_DOUBLE( szFileName, *UI );
    READ_DOUBLE( szFileName, *VI );
    READ_DOUBLE( szFileName, *GX );
    READ_DOUBLE( szFileName, *GY );
    READ_DOUBLE( szFileName, *PI );
    
    READ_INT   ( szFileName, *iproc );
    READ_INT   ( szFileName, *jproc );
    
    *dx = *xlength / (double)(*imax);
    *dy = *ylength / (double)(*jmax);
    
    return 1;
}
Ejemplo n.º 13
0
static void b_readroad(connection * b, gamedata * data)
{
    storage * store = data->store;
    int n;
    READ_INT(store, &n);
    b->data.sa[0] = (short)n;
    READ_INT(store, &n);
    b->data.sa[1] = (short)n;
}
Ejemplo n.º 14
0
static void wall_read(connection * b, gamedata * data)
{
    static wall_data dummy;
    wall_data *fd = b->data.v ? (wall_data *)b->data.v : &dummy;

    read_unit_reference(data, &fd->mage, NULL);
    READ_INT(data->store, &fd->force);
    READ_INT(data->store, &fd->countdown);
    fd->active = true;
}
Ejemplo n.º 15
0
static int read_keyval(gamedata *data, int *keys, int n) {
    int i;
    for (i = 0; i != n; ++i) {
        int key, val;
        READ_INT(data->store, &key);
        READ_INT(data->store, &val);
        keys[i * 2] = key;
        keys[i * 2 + 1] = val;
    }
    return n;
}
Ejemplo n.º 16
0
static void wall_read(connection * b, gamedata * data)
{
    static wall_data dummy;
    wall_data *fd = b->data.v ? (wall_data *)b->data.v : &dummy;

    read_reference(&fd->mage, data, read_unit_reference, resolve_unit);
    READ_INT(data->store, &fd->force);
    if (data->version >= NOBORDERATTRIBS_VERSION) {
        READ_INT(data->store, &fd->countdown);
    }
    fd->active = true;
}
Ejemplo n.º 17
0
Archivo: loader.c Proyecto: rousya/ktap
static int load_constants(struct load_state *S, ktap_proto *f)
{
	int i,n;

	n = READ_INT(S);

	f->sizek = n;
	f->k = NEW_VECTOR(S, n * sizeof(ktap_value));
	for (i = 0; i < n; i++)
		setnilvalue(&f->k[i]);

	for (i=0; i < n; i++) {
		ktap_value *o = &f->k[i];

		int t = READ_CHAR(S);
		switch (t) {
		case KTAP_TNIL:
			setnilvalue(o);
			break;
		case KTAP_TBOOLEAN:
			setbvalue(o, READ_CHAR(S));
			break;
		case KTAP_TNUMBER:
			/*
			 * todo: kernel not support fp, check double when
			 * loading
			 */
			setnvalue(o, READ_NUMBER(S));
			break;
		case KTAP_TSTRING:
			setsvalue(o, READ_STRING(S));
			break;
		default:
			kp_error(S->ks, "ktap: load_constants: "
					"unknow ktap_value\n");
			return -1;
			
		}
	}

	n = READ_INT(S);
	f->p = NEW_VECTOR(S, n * sizeof(ktap_proto));
	f->sizep = n;
	for (i = 0; i < n; i++)
		f->p[i] = NULL;
	for (i = 0; i < n; i++) {
		f->p[i] = kp_newproto(S->ks);
		if (load_function(S, f->p[i]))
			return -1;
	}

	return 0;
}
Ejemplo n.º 18
0
static int read_skill(struct storage *store, curse * c, void *target)
{
  int skill;
  if (global.data_version < CURSETYPE_VERSION) {
    READ_INT(store, &skill);
    READ_INT(store, 0); /* men, ignored */
  } else {
    READ_INT(store, &skill);
  }
  c->data.i = skill;
  return 0;
}
Ejemplo n.º 19
0
void read_encoders(void)
{
	static uint32_t old_encoder_state0 = 0, old_encoder_state1;

	encoder_state0 = READ_INT(LEDADDR) & 0xFFFF0000;
	encoder_state1 = READ_INT(KEYADDR0);

	encoder_changed0 = old_encoder_state0 ^ encoder_state0;
	encoder_changed1 = old_encoder_state1^encoder_state1;

	old_encoder_state0 = encoder_state0;
	old_encoder_state1 = encoder_state1;
}
Ejemplo n.º 20
0
variant read_region_reference(struct storage * store)
{
    variant result;
    if (global.data_version < UIDHASH_VERSION) {
        int n;
        READ_INT(store, &n);
        result.sa[0] = (short)n;
        READ_INT(store, &n);
        result.sa[1] = (short)n;
    }
    else {
        READ_INT(store, &result.i);
    }
    return result;
}
Ejemplo n.º 21
0
static int read_keyval_orig(gamedata *data, int *keys, int n) {
    int i, j = 0, dk = -1;
    for (i = 0; i != n; ++i) {
        int key, val;
        READ_INT(data->store, &key);
        READ_INT(data->store, &val);
        if (key > dk) {
            keys[j * 2] = key;
            keys[j * 2 + 1] = val;
            dk = key;
            ++j;
        }
    }
    return j;
}
Ejemplo n.º 22
0
static int read_skill(struct storage *store, curse * c, void *target)
{
    int skill;
    READ_INT(store, &skill);
    c->data.i = skill;
    return 0;
}
Ejemplo n.º 23
0
static int a_readmuseumgiveback(attrib * a, void *owner, struct gamedata *data)
{
    museumgiveback *gb = (museumgiveback *)a->data.v;
    READ_INT(data->store, &gb->cookie);
    read_items(data->store, &gb->items);
    return AT_READ_OK;
}
Ejemplo n.º 24
0
static int createunit_read(trigger * t, gamedata *data)
{
    createunit_data *td = (createunit_data *)t->data.v;
    variant var;
    int result = AT_READ_OK;
    var = read_faction_reference(data);
    if (var.i > 0) {
        td->f = findfaction(var.i);
        if (!td->f) {
            ur_add(var, &td->f, resolve_faction);
        }
    }
    else {
        result = AT_READ_FAIL;
    }
    // read_reference(&td->f, store, read_faction_reference, resolve_faction);

    read_reference(&td->r, data, read_region_reference,
        RESOLVE_REGION(data->version));
    td->race = (const struct race *)read_race_reference(data->store).v;
    if (!td->race) {
        result = AT_READ_FAIL;
    }
    READ_INT(data->store, &td->number);
    return result;
}
Ejemplo n.º 25
0
static int read_movement(attrib * a, void *owner, struct storage *store)
{
  READ_INT(store, &a->data.i);
  if (a->data.i != 0)
    return AT_READ_OK;
  else
    return AT_READ_FAIL;
}
Ejemplo n.º 26
0
static int read_movement(variant *var, void *owner, gamedata *data)
{
    READ_INT(data->store, &var->i);
    if (var->i != 0)
        return AT_READ_OK;
    else
        return AT_READ_FAIL;
}
Ejemplo n.º 27
0
static int tolua_storage_read_int(lua_State * L)
{
  gamedata *data = (gamedata *)tolua_tousertype(L, 1, 0);
  int num;
  READ_INT(data->store, &num);
  tolua_pushnumber(L, (lua_Number) num);
  return 1;
}
Ejemplo n.º 28
0
static int unitmessage_read(trigger * t, struct storage *store)
{
  unitmessage_data *td = (unitmessage_data *) t->data.v;
  char zText[256];

  int result =
    read_reference(&td->target, store, read_unit_reference, resolve_unit);
  READ_TOK(store, zText, sizeof(zText));
  td->string = _strdup(zText);
  READ_INT(store, &td->type);
  READ_INT(store, &td->level);

  if (result == 0 && td->target == NULL) {
    return AT_READ_FAIL;
  }
  return AT_READ_OK;
}
Ejemplo n.º 29
0
static int a_readdirection(attrib * a, void *owner, struct gamedata *data)
{
    struct storage *store = data->store;
    spec_direction *d = (spec_direction *)(a->data.v);
    char lbuf[32];

    unused_arg(owner);
    READ_INT(store, &d->x);
    READ_INT(store, &d->y);
    READ_INT(store, &d->duration);
    READ_TOK(store, lbuf, sizeof(lbuf));
    d->desc = _strdup(lbuf);
    READ_TOK(store, lbuf, sizeof(lbuf));
    d->keyword = _strdup(lbuf);
    d->active = true;
    return AT_READ_OK;
}
Ejemplo n.º 30
0
/* Convert the bios version which is stored in a numeric way to a string.
/  On NV40 bioses it is stored in 5 numbers instead of 4 which was the
/  case on old cards. The bios version on old cards could be bigger than
/  4 numbers too but that version was only stored in a string which was
/  hard to locate. On NV40 cards the version is stored in a string too,
/  for which the offset can be found at +3 in the 'S' table.
*/
static char *nv40_bios_version_to_str(char *rom, short offset)
{
	char res[16];
	int version = READ_INT(rom, offset);
	unsigned char extra = rom[offset+4];

	snprintf(res, 16,"%02X.%02x.%02x.%02x.%02x%c", (version>>24) & 0xff, (version>>16) & 0xff, (version>>8) & 0xff, version&0xff, extra, '\0');
	 return (char*)STRDUP(res,16);
}