本文整理汇总了C++中VAR函数的典型用法代码示例。如果您正苦于以下问题:C++ VAR函数的具体用法?C++ VAR怎么用?C++ VAR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VAR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VAR
void ScummEngine_v72he::resetScummVars() {
ScummEngine_v70he::resetScummVars();
VAR(VAR_VIDEO_PERFORMANCE) = 26;
VAR(VAR_NUM_ROOMS) = _numRooms - 1;
VAR(VAR_NUM_SCRIPTS) = _numScripts - 1;
VAR(VAR_NUM_SOUNDS) = _numSounds - 1;
VAR(VAR_NUM_COSTUMES) = _numCostumes - 1;
VAR(VAR_NUM_IMAGES) = _numImages - 1;
VAR(VAR_NUM_CHARSETS) = _numCharsets - 1;
VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1;
if (_game.heversion <= 74) {
// Songs are disabled, if sound is disabled.
VAR(VAR_SOUND_ENABLED) = 1;
}
if (_game.heversion == 74) {
// Uses different values, compared to later HE80+ games.
if (_game.platform == Common::kPlatformMacintosh) {
VAR(VAR_PLATFORM) = 3;
} else {
VAR(VAR_PLATFORM) = 2;
}
}
}
示例2: VAR
Obj *prim_cons(Env *env, Obj *root, Obj **list)
{
VAR(args);
*args = eval_list(env, root, list);
return make_cell(env, root, &(*args)->car, &(*args)->cdr->car);
}
示例3: settabsize
/* Returns non-zero if tab size changed */
int settabsize(unsigned mode)
{
switch (mode & MAJORMODE) {
case CMODE:
if (Tabsize == VAR(VCTABS))
return 0;
return Tabsize = VAR(VCTABS);
case SHMODE:
if (Tabsize == VAR(VTABS) && Taboffset == VAR(VSHTABS))
return 0;
Taboffset = VAR(VSHTABS);
return Tabsize = VAR(VTABS);
case PYMODE:
if (Tabsize == VAR(VSHTABS) && Taboffset == VAR(VSHTABS))
return 0;
return Tabsize = Taboffset = VAR(VSHTABS);
default:
if (Tabsize == VAR(VTABS))
return 0;
return Tabsize = VAR(VTABS);
}
}
示例4: pass_CallNode
static int
pass_CallNode(void *self, Pass pass, int level, void *par)
{
VAR(CallNode, np, self);
switch (pass)
{
case Print:
fprintfOffs(stdout, level, "CallNode: %s (%d) byref=%d, isC=%d, rest=%d\n", np->name, np->argc, np->byref, np->isC, np->rest);
break;
case PrintSrc:
{
VAR(CodestrNode, cp, par);
VAR(StrBuf, out, cp->buf);
VAR(Node, npp, self);
int r, n = 0;
putString_StrBuf(out, np->name);
putString_StrBuf(out, "(");
for (r = first_List(&npp->list); r; r = next_List(&npp->list))
{
VAR(Node, p, npp->list.current_of_List);
if (n)
putString_StrBuf(out, ", ");
n++;
if (p->pass(p, pass, level + 1, par))
break;
}
putString_StrBuf(out, ")");
}
return 0;
case Codegen1:
{
Node *npp = (Node *) np;
int r;
for (r = first_List(&npp->list); r; r = next_List(&npp->list))
{
VAR(Node, p, npp->list.current_of_List);
if (!strcmp(p->name, "ref"))
{
Node *np1 = ((RefNode *) p)->expr;
if (np1 && !strcmp(np1->name, "fmemvar"))
{
((VarNode *) np1)->isArg = 1;
}
}
}
}
break;
case CalcDeep:
{
VAR(Function, fp, par);
int deep, ret;
np->isC = add_to_undeclared(np->name, &np->func);
addDeep(fp, 1);
deep = fp->deep_of_Function;
ret = pass_Node(self, pass, level, par);
fp->deep_of_Function = deep;
if (np->func && !np->func->isPublic_of_Function)
np->name = np->func->name_of_Function;
return ret;
}
break;
case CText:
{
VAR(FILE, out, par);
fprintfOffs(out, level, "_clip_push_nil( _mp );\n");
pass_Node(self, pass, level - 1, par);
switch (np->isC)
{
case 2:
fprintfOffs(out, level, "if ( (_ret=_clip_%s(_mp, clip_%s, %d, %d, %s))) goto _trap_%d;\n", np->node.isTop ? "proc" : "func", np->name, np->argc, np->rest, ref_name(np), np->node.seqNo);
break;
case 1:
case 0:
fprintfOffs(out, level,
"if ( (_ret=_clip_%s_hash(_mp, %ld /* %s */, %d, %d, %s))) goto _trap_%d;\n",
np->node.isTop ? "proc" : "func", (long) hashstr(np->name), np->name, np->argc, np->rest, ref_name(np), np->node.seqNo);
break;
}
return 0;
}
break;
case OText:
{
VAR(StrBuf, out, par);
putByte_StrBuf(out, CLIP_PUSH_NIL);
pass_Node(self, pass, level - 1, par);
switch (np->isC)
{
case 2:
if (np->node.isTop)
putByte_StrBuf(out, np->rest ? CLIP_SPROCR : CLIP_SPROC);
else
putByte_StrBuf(out, np->rest ? CLIP_SFUNCR : CLIP_SFUNC);
putByte_StrBuf(out, np->argc);
putShort_StrBuf(out, np->func->mno_of_Function);
//.........这里部分代码省略.........
示例5: ConfigAppLoad
// Read in the config file for the whole application
int ConfigAppLoad()
{
TCHAR szConfig[MAX_PATH];
TCHAR szLine[1024];
FILE* h;
#ifdef _UNICODE
setlocale(LC_ALL, "");
#endif
CreateConfigName(szConfig);
if ((h = _tfopen(szConfig, _T("rt"))) == NULL) {
return 1;
}
// Go through each line of the config file
while (_fgetts(szLine, sizeof(szLine), h)) {
int nLen = _tcslen(szLine);
// Get rid of the linefeed at the end
if (szLine[nLen - 1] == 10) {
szLine[nLen - 1] = 0;
nLen--;
}
#define VAR(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x)); \
if (szValue) x = _tcstol(szValue, NULL, 0); }
#define VAR64(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x)); \
if (szValue) x = (long long)_tcstod(szValue, NULL); }
#define FLT(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x)); \
if (szValue) x = _tcstod(szValue, NULL); }
#define STR(x) { TCHAR* szValue = LabelCheck(szLine,_T(#x) _T(" ")); \
if (szValue) _tcscpy(x,szValue); }
VAR(nIniVersion);
// Emulation
VAR(bBurnUseASMCPUEmulation);
// Video
VAR(nVidDepth); VAR(nVidRefresh);
VAR(nVidRotationAdjust);
// horizontal oriented
VAR(nVidHorWidth); VAR(nVidHorHeight);
VAR(bVidArcaderesHor);
VAR(VidPreset[0].nWidth); VAR(VidPreset[0].nHeight);
VAR(VidPreset[1].nWidth); VAR(VidPreset[1].nHeight);
VAR(VidPreset[2].nWidth); VAR(VidPreset[2].nHeight);
VAR(VidPreset[3].nWidth); VAR(VidPreset[3].nHeight);
VAR(nScreenSizeHor);
// vertical oriented
VAR(nVidVerWidth); VAR(nVidVerHeight);
VAR(bVidArcaderesVer);
VAR(VidPresetVer[0].nWidth); VAR(VidPresetVer[0].nHeight);
VAR(VidPresetVer[1].nWidth); VAR(VidPresetVer[1].nHeight);
VAR(VidPresetVer[2].nWidth); VAR(VidPresetVer[2].nHeight);
VAR(VidPresetVer[3].nWidth); VAR(VidPresetVer[3].nHeight);
VAR(nScreenSizeVer);
VAR(nWindowSize);
VAR(nWindowPosX); VAR(nWindowPosY);
VAR(bDoGamma);
VAR(bVidUseHardwareGamma);
VAR(bHardwareGammaOnly);
FLT(nGamma);
VAR(bVidFullStretch);
VAR(bVidCorrectAspect);
VAR(bVidAutoSwitchFull);
VAR(bVidTripleBuffer);
VAR(bVidVSync);
VAR(bVidScanlines);
VAR(nVidScanIntensity);
VAR(bMonitorAutoCheck);
VAR(nVidScrnAspectX);
VAR(nVidScrnAspectY);
VAR(bForce60Hz);
VAR(bAlwaysDrawFrames);
VAR(bVidUsePlaceholder);
STR(szPlaceHolder);
VAR(nVidSelect);
VAR(nVidBlitterOpt[0]);
VAR64(nVidBlitterOpt[1]);
VAR(nVidBlitterOpt[2]);
VAR(nVidBlitterOpt[3]);
// DirectDraw blitter
VAR(bVidScanHalf);
// Direct3D blitter
VAR(bVidBilinear);
VAR(bVidScanDelay);
//.........这里部分代码省略.........
示例6: hlist
term hlist(register term H, register term regs, stack wam)
{ no i; cell xval; bp_long ival; byte stamp;
#if TRACE>0
fprintf(STD_err,"entering hlist, wam=%d, bboard=%d H=%d\n",
wam,g.shared[BBoardStk].base,H);
bbcheck(wam);
#endif
if(!INTEGER(X(1))) return NULL; /* first arg: stamp */
stamp=(byte)(OUTPUT_INT(X(1)));
xval=X(2); /* second arg: starting arity of listed terms */
if(!INTEGER(xval)) return NULL;
ival=OUTPUT_INT(xval);
for(i=0; i<HMAX; i++)
if(hstamp[i]>=stamp && HUSED())
{ term xref=C2T(g.predmark);
if(hstamp[i]<=RUNTIME)
{ /* gets preds of arity < ival `represented' as g.predmark*/
if(g.predmark!=htable[i].pred
|| GETARITY(htable[i].fun)<(no)ival)
continue;
xval=g.predmark;
}
else
{ /* gets RUNTIME data of arity > ival */
cell v=htable[i].val;
if(NULL==(term)v)
continue;
if(VAR(v) &&
!(
ONSTACK(g.shared[BBoardStk],v) ||
ONSTACK(g.shared[InstrStk],v) /*|| ON(HeapStk,v) */
)) {
#if TRACE>0
fprintf(STD_err,
"unexpected data in htable[%d]=>\n<%s,%s>->%s\n",i,
smartref(htable[i].pred,wam),
smartref(htable[i].fun,wam),
smartref(v,wam));
#endif
/* continue; */
}
FDEREF(v);
if((INTEGER(xval) && ival>0)
|| VAR(xval)
|| (GETARITY(xval) < (no)ival)
|| xval==g.empty
)
continue;
if(COMPOUND(xval))
xval=T2C(xref);
}
IF_OVER("COPY_KEYS",(term *)H,HeapStk,bp_halt(9));
SAVE_FUN(htable[i].pred);
SAVE_FUN(htable[i].fun);
#if 0
ASSERT2(( ATOMIC(xval)
|| ONSTACK(g.shared[BBoardStk],xval)
|| ON(HeapStk,xval)), /* will fail with multiple engines */
xval);
#endif
PUSH_LIST(xval);
}
PUSH_NIL();
return H;
}
示例7: before
void before() {
for(int i=1;i<reps*history_size;i++)
VAR(done[i]) = false;
}
示例8: fetchScriptByte
void ScummEngine_v60he::o60_roomOps() {
int a, b, c, d, e;
byte subOp = fetchScriptByte();
switch (subOp) {
case 172: // SO_ROOM_SCROLL
b = pop();
a = pop();
if (a < (_screenWidth / 2))
a = (_screenWidth / 2);
if (b < (_screenWidth / 2))
b = (_screenWidth / 2);
if (a > _roomWidth - (_screenWidth / 2))
a = _roomWidth - (_screenWidth / 2);
if (b > _roomWidth - (_screenWidth / 2))
b = _roomWidth - (_screenWidth / 2);
VAR(VAR_CAMERA_MIN_X) = a;
VAR(VAR_CAMERA_MAX_X) = b;
break;
case 174: // SO_ROOM_SCREEN
b = pop();
a = pop();
if (_game.heversion >= 71)
initScreens(a, _screenHeight);
else
initScreens(a, b);
break;
case 175: // SO_ROOM_PALETTE
d = pop();
c = pop();
b = pop();
a = pop();
setPalColor(d, a, b, c);
break;
case 176: // SO_ROOM_SHAKE_ON
setShake(1);
break;
case 177: // SO_ROOM_SHAKE_OFF
setShake(0);
break;
case 179: // SO_ROOM_INTENSITY
c = pop();
b = pop();
a = pop();
darkenPalette(a, a, a, b, c);
break;
case 180: // SO_ROOM_SAVEGAME
_saveTemporaryState = true;
_saveLoadSlot = pop();
_saveLoadFlag = pop();
break;
case 181: // SO_ROOM_FADE
a = pop();
if (_game.heversion >= 70) {
// Defaults to 1 but doesn't use fade effects
} else if (a) {
_switchRoomEffect = (byte)(a & 0xFF);
_switchRoomEffect2 = (byte)(a >> 8);
} else {
fadeIn(_newEffect);
}
break;
case 182: // SO_RGB_ROOM_INTENSITY
e = pop();
d = pop();
c = pop();
b = pop();
a = pop();
darkenPalette(a, b, c, d, e);
break;
case 183: // SO_ROOM_SHADOW
e = pop();
d = pop();
c = pop();
b = pop();
a = pop();
if (_game.heversion == 60)
setShadowPalette(a, b, c, d, e, 0, 256);
break;
case 186: // SO_ROOM_TRANSFORM
d = pop();
c = pop();
b = pop();
a = pop();
palManipulateInit(a, b, c, d);
break;
case 187: // SO_CYCLE_SPEED
b = pop();
//.........这里部分代码省略.........
示例9: startScene
/**
* Start a 'scene' by loading the specified room with the given main actor.
* The actor is placed next to the object indicated by objectNr.
*/
void startScene(int room, Actor* a, int objectNr)
{
int i, where;
printf("Loading room %d\n", room);
stopTalk();
//fadeOut(_switchRoomEffect2);
//_newEffect = _switchRoomEffect;
ScriptSlot *ss = &vm.slot[_currentScript];
if (_currentScript != 0xFF) {
if (ss->where == WIO_ROOM || ss->where == WIO_FLOBJECT) {
if (ss->cutsceneOverride)
printf("Error: Object %d stopped with active cutscene/override in exit\n", ss->number);
//nukeArrays(_currentScript);
_currentScript = 0xFF;
} else if (ss->where == WIO_LOCAL) {
if (ss->cutsceneOverride)
printf("Error: Script %d stopped with active cutscene/override in exit\n", ss->number);
//nukeArrays(_currentScript);
_currentScript = 0xFF;
}
}
VAR(VAR_NEW_ROOM) = room;
runExitScript();
killScriptsAndResources();
InitFrameBuffers();
// For HE80+ games
for (i = 0; i < 4096; i++)
_roomVars[i] = 0;
//nukeArrays(0xFF);
for (i = 1; i < _numActors; i++) {
hideActor(&_actors[i]);
}
/*for (i = 0; i < 256; i++) {
_roomPalette[i] = i;
if (_shadowPalette)
_shadowPalette[i] = i;
}*/
VAR(VAR_ROOM) = room;
//_fullRedraw = true;
//_res->increaseResourceCounters();
_currentRoom = room;
VAR(VAR_ROOM) = room;
//if (room >= 0x80 && _game.version < 7 && _game.heversion <= 71)
// _roomResource = _resourceMapper[room & 0x7F];
//else
_roomResource = room;
VAR(VAR_ROOM_RESOURCE) = _roomResource;
//if (room != 0)
// ensureResourceLoaded(rtRoom, room);
//clearRoomObjects();
ClearObjectFrameBuffer();
clearDrawObjectQueue();
if(RoomResource != NULL) freeLFLF(RoomResource);
if (_currentRoom == 0) {
RoomResource = NULL;
//_ENCD_offs = _EXCD_offs = 0;
//_numObjectsInRoom = 0;
return;
}
else
{
readRoom(HE1_File, &Room, getLFLFOffset(HE0_File, &HE0_Data, room));
RoomResource = &Room;
ConvertRoomBackground(HE1_File, RoomResource);
}
//setupRoomSubBlocks();
//resetRoomSubBlocks();
//initBGBuffers(_roomHeight);
//.........这里部分代码省略.........
示例10: switch
void Map_v2::loadMapObjects(const char *avjFile) {
uint8 wayPointsCount;
uint16 var;
int16 id;
int16 mapWidth, mapHeight;
int16 tmp;
byte *variables;
uint32 tmpPos;
uint32 passPos;
var = _vm->_game->_script->readVarIndex();
variables = _vm->_inter->_variables->getAddressOff8(var);
id = _vm->_game->_script->readInt16();
if (((uint16) id) >= 65520) {
switch ((uint16) id) {
case 65530:
for (int i = 0; i < _mapWidth * _mapHeight; i++)
_passMap[i] -= READ_VARO_UINT8(var + i);
break;
case 65531:
for (int i = 0; i < _mapWidth * _mapHeight; i++)
_passMap[i] += READ_VARO_UINT8(var + i);
break;
case 65532:
for (int i = 0; i < _mapWidth * _mapHeight; i++)
WRITE_VARO_UINT8(var + i, 0x00);
break;
case 65533:
warning("Map_v2::loadMapObjects(): ID == 65533");
break;
case 65534:
_tilesWidth = READ_VARO_UINT8(var);
_tilesHeight = READ_VARO_UINT8(var + 1);
_mapWidth = READ_VARO_UINT8(var + 2);
_mapHeight = READ_VARO_UINT8(var + 3);
_mapUnknownBool = READ_VARO_UINT8(var + 4) ? true : false;
break;
case 65535:
_passMap = (int8 *)_vm->_inter->_variables->getAddressOff8(var);
break;
default:
warning("Map_v2::loadMapObjects(): ID == %d", (uint16) id);
break;
}
return;
}
Resource *resource = _vm->_game->_resources->getResource(id);
if (!resource)
return;
Common::SeekableReadStream &mapData = *resource->stream();
_mapVersion = mapData.readByte();
if (_mapVersion == 4) {
_screenWidth = 640;
_screenHeight = 400;
} else if (_mapVersion == 3) {
_passWidth = 65;
_screenWidth = 640;
_screenHeight = 200;
} else {
_passWidth = 40;
_screenWidth = 320;
_screenHeight = 200;
}
_wayPointCount = mapData.readByte();
_tilesWidth = mapData.readSint16LE();
_tilesHeight = mapData.readSint16LE();
_bigTiles = !(_tilesHeight & 0xFF00);
_tilesHeight &= 0xFF;
if (_mapVersion == 4) {
_screenWidth = mapData.readSint16LE();
_screenHeight = mapData.readSint16LE();
}
_mapWidth = _screenWidth / _tilesWidth;
_mapHeight = _screenHeight / _tilesHeight;
passPos = mapData.pos();
mapData.skip(_mapWidth * _mapHeight);
if (resource->getData()[0] == 1)
wayPointsCount = _wayPointCount = 40;
else
wayPointsCount = _wayPointCount == 0 ? 1 : _wayPointCount;
delete[] _wayPoints;
_wayPoints = new WayPoint[wayPointsCount];
for (int i = 0; i < _wayPointCount; i++) {
_wayPoints[i].x = mapData.readSByte();
_wayPoints[i].y = mapData.readSByte();
_wayPoints[i].notWalkable = mapData.readSByte();
}
//.........这里部分代码省略.........
示例11: FUNC
FUNC(void, OS_CODE) tpl_init_pit(void)
{
TPL_PIT.MCR = PIT_MCR_FRZ;
}
#if 0 /* We're using the generated function tpl_load_pits for now */
/**
* tpl_load_pit loads the given pit channel with a value and starts the channel
*
* @param pit chan pit channel id to load
* @param ticks value to load
*
*/
FUNC(void, OS_CODE) tpl_load_pit(
VAR(uint8, AUTOMATIC) chan,
VAR(uint32, AUTOMATIC) ticks)
{
/* loads the value */
PIT_LVR(chan) = ticks;
/* clear interrupt flag */
PIT_FR(chan) = PIT_FR_TIF;
/* start the channel and enable interrupt */
PIT_CR(chan) = PIT_CR_TEN | PIT_CR_TIE;
}
/**
* tpl_start_pit starts a given pit channel
*
* @param pit chan pit channel id to start
*
示例12: getDescriptor
void getDescriptor(int W, int H, const double *SSH, int x1, int y1, int x2, int y2, int DS1, int DS2, double *descriptor)
{
int bbwidth=x2-x1;
int bbheight=y2-y1;
for(uint a=0;a<DS1;++a) {
int il=int(x1+a*bbwidth/DS1)-1;
int iu=int((x1)+(a+1)*bbwidth/DS1);
for(uint b=0;b<DS1;++b) {
int jl=int(y1+b*bbheight/DS1)-1;
int ju=int((y1)+(b+1)*bbheight/DS1);
for(uint c=0;c<DS2;++c) {
int xl=int(x1+c*bbwidth/DS2)-1;
int xu=int((x1)+(c+1)*bbwidth/DS2);
for(uint d=0;d<DS2;++d) {
int yl=int(y1+d*bbheight/DS2)-1;
int yu=int((y1)+(d+1)*bbheight/DS2);
DBG(10) << VAR(il) << " - " << VAR(iu) <<" "
<< VAR(jl) << " - " << VAR(ju) <<" "
<< VAR(xl) << " - " << VAR(xu) <<" "
<< VAR(yl) << " - " << VAR(yu) << std::endl;
descriptor[b+a*DS1+d*DS1*DS1+c*DS1*DS1*DS2]
= MATRIX(SSH, ju , iu , yu , xu , H, W, H, W)
- MATRIX(SSH, jl, iu, yu, xu, H, W, H, W)
- MATRIX(SSH, ju, il, yu, xu, H, W, H, W)
- MATRIX(SSH, ju, iu, yl, xu, H, W, H, W)
- MATRIX(SSH, ju, iu, yu, xl, H, W, H, W)
+ MATRIX(SSH, jl, il, yu, xu, H, W, H, W)
+ MATRIX(SSH, jl, iu, yl, xu, H, W, H, W)
+ MATRIX(SSH, jl, iu, yu, xl, H, W, H, W)
+ MATRIX(SSH, ju, il, yl, xu, H, W, H, W)
+ MATRIX(SSH, ju, il, yu, xl, H, W, H, W)
+ MATRIX(SSH, ju, iu, yl, xl, H, W, H, W)
- MATRIX(SSH, ju, il, yl, xl, H, W, H, W)
- MATRIX(SSH, jl, iu, yl, xl, H, W, H, W)
- MATRIX(SSH, jl, il, yu, xl, H, W, H, W)
- MATRIX(SSH, jl, il, yl, xu, H, W, H, W)
+ MATRIX(SSH , jl, il, yl, xl, H, W, H, W);
DBG(10) << "[" << a << " " << b << " " << c << " " << d <<"]:"
<< xl << "-" << xu << " "
<< yl << "-" << yu << " "
<< il << "-" << iu << " "
<< jl << "-" << ju << " "
<< " V=" << MATRIX(descriptor, b,a,d,c, DS1,DS1,DS2,DS2)
<< std::endl;
//DBG(10) << VAR(b)<< " " <<VAR(a) << " " <<VAR(d) << " " << VAR(c) << " "<< VAR(MATRIX(descriptor, b,a,d,c, DS1,DS1,DS2,DS2)) << std::endl;
}
}
}
}
}
示例13: qPBReaderDialog
//.........这里部分代码省略.........
// bottom margin
_pBottom = new qPBReaderSetValueWidgetWithLabel("Bottom margin", this);
_pBottom->_pSetValueWidget->SetText(QString::number(bottom));
_pBottom->_pSetValueWidget->setEnabled(!bUseBookMargin);
pVert->AddWidget(_pBottom);
QObject::connect(_pUseBookMarginCheckBox, SIGNAL(stateChanged(int)),
this, SLOT(UseBookMarginChanged(int)));
QObject::connect(_pTop->_pSetValueWidget, SIGNAL(Minus()),
this , SLOT(TopMarginMinus()));
QObject::connect(_pTop->_pSetValueWidget, SIGNAL(Plus()),
this , SLOT(TopMarginPlus()));
QObject::connect(_pSide->_pSetValueWidget, SIGNAL(Minus()),
this , SLOT(SideMarginMinus()));
QObject::connect(_pSide->_pSetValueWidget, SIGNAL(Plus()),
this , SLOT(SideMarginPlus()));
QObject::connect(_pBottom->_pSetValueWidget, SIGNAL(Minus()),
this , SLOT(BottomMarginMinus()));
QObject::connect(_pBottom->_pSetValueWidget, SIGNAL(Plus()),
this , SLOT(BottomMarginPlus()));
}
// ----------------------------------
// hyphens
// ----------------------------------
{
QString sHyphenPatt = qPBReaderConfig::GetDefaultHyphenPatternLang();
bool bUseHyphens = !sHyphenPatt.isEmpty();
Qt::CheckState state = bUseHyphens ? Qt::Checked : Qt::Unchecked;
TRACE << VAR(bUseHyphens) << endl;
const QStringList & lsLang = qPBReaderLangLists::GetAvailableHyphenPatterns();
// use hyphens
_pUseHyphens = new QCheckBox(tr("Hyphenation"), pVert);
_pUseHyphens->setCheckState(state);
pVert->AddWidget(_pUseHyphens);
// hyphen lang
_pHyphenDic = new qPBReaderComboBox(tr("Hyphen dictionary language"), this);
_pHyphenDic->_pComboBox->addItems(lsLang);
int nPos = lsLang.indexOf(sHyphenPatt);
if (nPos < 0)
{
nPos = 9; // en-us
}
_pHyphenDic->_pComboBox->setCurrentIndex(nPos);
_pHyphenDic->_pComboBox->setEnabled(bUseHyphens);
pVert->AddWidget(_pHyphenDic);
QObject::connect(_pUseHyphens, SIGNAL(stateChanged(int)),
this, SLOT(UseHyphensChanged(int)));
QObject::connect(_pHyphenDic->_pComboBox,
SIGNAL(currentIndexChanged(const QString &)),
this, SLOT(HyphenDicChanged(const QString &)));
}
// ----------------------------------
// fonts
// ----------------------------------
示例14: switch
void ScummEngine::resetScummVars() {
if (_game.heversion < 70 && _game.version <= 6) {
// VAR_SOUNDCARD modes
// 0 PC Speaker
// 1 Tandy
// 2 CMS
// 3 AdLib
// 4 Roland
switch (_sound->_musicType) {
case MDT_NONE:
case MDT_PCSPK:
VAR(VAR_SOUNDCARD) = 0;
break;
case MDT_PCJR:
VAR(VAR_SOUNDCARD) = 1;
break;
case MDT_CMS:
VAR(VAR_SOUNDCARD) = 2;
break;
case MDT_ADLIB:
VAR(VAR_SOUNDCARD) = 3;
break;
default:
if ((_game.id == GID_MONKEY_EGA || _game.id == GID_MONKEY_VGA || (_game.id == GID_LOOM && _game.version == 3))
&& (_game.platform == Common::kPlatformDOS)) {
VAR(VAR_SOUNDCARD) = 4;
} else {
VAR(VAR_SOUNDCARD) = 3;
}
break;
}
if (_game.platform == Common::kPlatformFMTowns)
VAR(VAR_VIDEOMODE) = 42;
// Value only used by the Macintosh version of Indiana Jones and the Last Crusade
else if (_game.platform == Common::kPlatformMacintosh && _game.version == 3)
VAR(VAR_VIDEOMODE) = 50;
// Value only used by the Amiga version of Monkey Island 2
else if (_game.platform == Common::kPlatformAmiga)
VAR(VAR_VIDEOMODE) = 82;
else if (_renderMode == Common::kRenderCGA)
VAR(VAR_VIDEOMODE) = 4;
else if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG)
VAR(VAR_VIDEOMODE) = 30;
else if (_renderMode == Common::kRenderEGA)
VAR(VAR_VIDEOMODE) = 13;
else
VAR(VAR_VIDEOMODE) = 19;
if (_game.platform == Common::kPlatformMacintosh && (_game.features & GF_OLD_BUNDLE)) {
// Set screen size for the Macintosh version of Indy3/Loom
VAR(39) = 320;
}
if (_game.platform == Common::kPlatformDOS && _game.id == GID_LOOM && _game.version == 3) {
// Set number of sound resources
VAR(39) = 80;
}
if (_game.id == GID_LOOM || _game.version >= 4)
VAR(VAR_HEAPSPACE) = 1400;
if (_game.version >= 4)
VAR(VAR_FIXEDDISK) = 1;
if (_game.version >= 5)
VAR(VAR_INPUTMODE) = 3;
if (_game.version == 6)
VAR(VAR_V6_EMSSPACE) = 10000;
if (_game.heversion >= 60) {
// Set fast speed, to enable all animations
VAR(VAR_MACHINE_SPEED) = 2;
VAR(VAR_SOUNDPARAM) = 1; // Soundblaster for music
VAR(VAR_SOUNDPARAM2) = 1; // Soundblaster for sound effects
}
}
if (VAR_ROOM_WIDTH != 0xFF && VAR_ROOM_HEIGHT != 0xFF) {
VAR(VAR_ROOM_WIDTH) = _screenWidth;
VAR(VAR_ROOM_HEIGHT) = _screenHeight;
}
if (VAR_DEBUGMODE != 0xFF) {
VAR(VAR_DEBUGMODE) = _debugMode;
if (_game.heversion >= 80 && _debugMode)
VAR(85) = 1;
}
if (VAR_FADE_DELAY != 0xFF)
VAR(VAR_FADE_DELAY) = 3;
VAR(VAR_CHARINC) = 4;
setTalkingActor(0);
}
示例15: b
Model::Model(const std::string& filename, VARAreaRef varStatic) {
// This loads an IFS file. Note that we could have used G3D::IFSModel::load to
// parse the file for us.
// file :=
// fileheader +
// vertexheader +
// vertex* +
// triheader +
// tri*
//
// fileheader := (string32) "IFS" + (float32)1.0 + (string32)modelname
// vertexheader := (string32) "VERTICES" + (uint32)numVertices
// vertex := (float32)x + (float32)y + (float32)z
// triheader := (string32)"TRIANGLES" + (uint32)numFaces
// tri := (uint32)v0 + (uint32)v1 + (uint32)v2
Log::common()->println(std::string("Loading ") + filename);
BinaryInput b(filename, G3D_LITTLE_ENDIAN);
std::string fmt = b.readString32();
float version = b.readFloat32();
(void) version;
std::string name = b.readString32();
debugAssert(fmt == "IFS");
debugAssert(version == 1.0);
std::string vertexHeader = b.readString32();
// Load the vertices
vertex.resize(b.readUInt32());
for (int v = 0; v < vertex.size(); ++v) {
vertex[v] = b.readVector3() * 5;
}
// Per-vertex normals
normal.resize(vertex.size());
// Load the triangles
std::string triHeader = b.readString32();
int numTris = b.readUInt32();
for (int t = 0; t < numTris; ++t) {
int v0 = b.readUInt32();
int v1 = b.readUInt32();
int v2 = b.readUInt32();
// Compute the non-unit face normal
Vector3 faceNormal =
(vertex[v1] - vertex[v0]).cross(
(vertex[v2] - vertex[v0]));
normal[v0] += faceNormal;
normal[v1] += faceNormal;
normal[v2] += faceNormal;
// Record the indices
index.append(v0, v1, v2);
}
// Rescale the normals to unit length
for (int n = 0; n < normal.size(); ++n) {
normal[n] = normal[n].direction();
}
varVertex = VAR(vertex, varStatic);
varNormal = VAR(normal, varStatic);
debugAssertGLOk();
}