void Terminal::clear() { const uint16_t clearVal = makeEntry(' ', color); for (size_t y = 0; y < VGA_HEIGHT; y++) { for (size_t x = 0; x < VGA_WIDTH; x++) { const size_t index = y * VGA_WIDTH + x; buffer[index] = clearVal; } } moveCursor(); }
static int enterBlockSolutions ( PUZZLE *puzzle, int row, int column, //int *solutions ) short **psolutions ) { int progress = 0; int rowMax = ( row + 1 ) * 3; int columnMax = ( column + 1 ) * 3; int k = 0; int i; #if defined(DEBUG) // fprintf ( logFile, "enterBlockSolutions ( %p, %d, %d, %p ) {\n", puzzle, // row, column, solutions ); fprintf ( logFile, "enterBlockSolutions ( %p, %d, %d, %p ) {\n", puzzle, row, column, psolutions ); fflush ( logFile ); #endif for ( i = rowMax - 3; i < rowMax; ++i ) { int j; for ( j = columnMax - 3; j < columnMax; ++j ) { //if ( solutions [k] ) { if ( star(psolutions [k]) ) { //if ( makeEntry ( puzzle, i, j, solutions [k] ) ) { if ( makeEntry ( puzzle, i, j, psolutions [k] ) ) { ++progress; updateRowMasks ( puzzle, i, psolutions [k] ); updateColumnMasks ( puzzle, j, psolutions [k] ); } } ++k; } } #if defined(DEBUG) fprintf ( logFile, "} = %d /* enterBlockSolutions () */\n", progress ); fflush ( logFile ); #endif return ( progress ); }
static int missingDigitScan ( PUZZLE *puzzle ) { int progress = 0; int i; #if defined(DEBUG) fprintf ( logFile, "missingDigitScan ( %p ) {\n", puzzle ); fflush ( logFile ); #endif puzzle->difficulty += 1; for ( i = 0; i < 9 && progress > -1; ++i ) { int j; for ( j = 0; j < 9 && progress > -1; ++j ) { if ( puzzle->grid [i][j] == 0 ) { int solution; if ( solution = bit2digit ( puzzle->masks [i][j] ) ) { ++progress; makeEntry ( puzzle, i, j, solution ); updateRowMasks ( puzzle, i, solution ); updateColumnMasks ( puzzle, j, solution ); updateBlockMasks ( puzzle, i, j, solution ); } else if ( ! puzzle->masks [i][j] ) progress = -1; } } } if ( progress > 0 ) puzzle->technique |= MISSING_DIGIT; #if defined(DEBUG) fprintf ( logFile, "} = %d /* missingDigitScan () */\n", progress ); fflush ( logFile ); #endif return ( progress ); }
void Terminal::scroll() { for (size_t i = 0; i < VGA_HEIGHT - 1; i++) { const size_t rowOffset = i * VGA_WIDTH; for (size_t j = 0; j < VGA_WIDTH; j++) { const size_t index = rowOffset + j; buffer[index] = buffer[index + VGA_WIDTH]; } } const size_t lastRowOffset = VGA_WIDTH * (VGA_HEIGHT - 1); const uint16_t clearEntry = makeEntry(' ', color); for (size_t i = 0; i < VGA_WIDTH; i++) { buffer[lastRowOffset + i] = clearEntry; } }
//static int enterRowSolutions ( PUZZLE *puzzle, int row, int *solutions ) static int enterRowSolutions ( PUZZLE *puzzle, int row, short **psolutions ) { int progress = 0; int column; #if defined(DEBUG) //fprintf ( logFile, "enterRowSolutions ( %p, %d, %p ) {\n", puzzle, row, //solutions ); fprintf ( logFile, "enterRowSolutions ( %p, %d, %p ) {\n", puzzle, row, psolutions ); fflush ( logFile ); #endif /* Display the solutions. */ for ( column = 0; column < 9; ++column ) { //if ( solutions [column] ) { if ( star(psolutions [column]) ) { //if ( makeEntry ( puzzle, row, column, solutions [column] ) ) { if ( makeEntry ( puzzle, row, column, psolutions [column] ) ) { ++progress; updateColumnMasks ( puzzle, column, psolutions [column] ); updateBlockMasks ( puzzle, row, column, psolutions [column] ); } } } #if defined(DEBUG) fprintf ( logFile, "} = %d /* enterRowSolutions () */\n", progress ); fflush ( logFile ); #endif return ( progress ); }
//static int enterColumnSolutions ( PUZZLE *puzzle, int column, int *solutions ) static int enterColumnSolutions ( PUZZLE *puzzle, int column, short **psolutions ) { int progress = 0; int row; #if defined(DEBUG) //fprintf ( logFile, "enterColumnSolutions ( %p, %d, %p ) {\n", puzzle, //column, solutions ); fprintf ( logFile, "enterColumnSolutions ( %p, %d, %p ) {\n", puzzle, column, psolutions ); fflush ( logFile ); #endif /* Enter the results of cross hatching the column. */ for ( row = 0; row < 9; ++row ) { //if ( solutions [row] ) { if ( star(psolutions [row]) ) { //if ( makeEntry ( puzzle, row, column, solutions [row] ) ) { if ( makeEntry ( puzzle, row, column, psolutions [row] ) ) { ++progress; updateRowMasks ( puzzle, row, psolutions [row] ); updateBlockMasks ( puzzle, row, column, psolutions [row] ); } } } #if defined(DEBUG) fprintf ( logFile, "} = %d /* enterColumnSolutions () */\n", progress ); fflush ( logFile ); #endif return ( progress ); }
void process(const char* filename, std::istream& ifs, std::ostream& ofs, std::ostream& indexfs) { int n = 1024; char tmpbuf[1024]; char tag[128]; char entry[1024]; while (!ifs.eof()) { ifs.getline(tmpbuf,n); if (ifs.eof()) break; ofs << tmpbuf; char* index; if ((index = strstr(tmpbuf, "BZINDEX")) != 0) { char* index2 = strstr(index, "-->"); if (index2 != 0) index2[-1] = 0; index += 8; sprintf(tag, "index%05d", tagnum++); ofs << "<a name=\"" << tag << "\">"; makeEntry(entry, index); indexfs << index << " |" << entry << "|" << filename << "#" << tag << std::endl; // std::cout << "Found tag: \"" << index << "\"" << std::endl; } ofs << std::endl; } }
char buf[40]; /*============================================================================= Data: =============================================================================*/ Camera svCamera; real32 svAngle = -150.0; real32 svDeclination = -20.0; real32 svZoomOutScalar = 1.1f; real32 svZoomInScalar = 1.05f; scriptEntry ShipViewTweaks[] = { makeEntry(svAngle, scriptSetReal32CB), makeEntry(svDeclination, scriptSetReal32CB), makeEntry(svZoomInScalar, scriptSetReal32CB), makeEntry(svZoomOutScalar,scriptSetReal32CB), END_SCRIPT_ENTRY }; ShipType svShipType = DefaultShip; sdword svMouseCentreX = 0; sdword svMouseCentreY = 0; sdword svMouseLastX = 0; sdword svMouseLastY = 0; bool8 svMouseInside = FALSE;
//static int enterClues ( PUZZLE *puzzle, char *clues ) static int enterClues ( PUZZLE *puzzle, short **pclues ) { int status = 0; int row = 0; int column = 0; #if defined(DEBUG) //fprintf ( logFile, "enterClues ( %p, \"%s\" ) {\n", puzzle, clues ); fprintf ( logFile, "enterClues ( %p, %p ) {\n", puzzle, pclues ); fflush ( logFile ); #endif //while ( *clues ) { while ( star(*pclues) ) { //if ( isdigit ( *clues ) ) { if ( isdigit ( star(*pclues) ) ) { //int clue = *clues - '0'; short clue = star(*pclues) - '0'; short *pclue = &clue; IFT(pclue, *pclues); //if (TEST(*pclues)) pclue = TAINT(pclue); #if defined(DEBUG) fprintf ( logFile, "EEE: %p, %p\n", pclue, *pclues ); fflush ( logFile ); #endif if ( column > 8 ) { column = 0; if ( ++row > 8 ) break; } if ( clue > 0 ) { if ( ! ( status //= makeEntry ( puzzle, row, column, clue ) ) ) = makeEntry ( puzzle, row, column, pclue ) ) ) break; } ++column; } ++pclues; } if ( status ) { for ( row = 0; row < 9; ++row ) { for ( column = 0; column < 9; ++column ) { if ( puzzle->grid [row][column] == 0 ) { puzzle->masks [row][column] = ( puzzle->rowMasks [row] & puzzle->columnMasks [column] & puzzle->blockMasks [row/3][column/3] ); IFT(puzzle->pmasks [row][column], puzzle->prowMasks [row]); IFT(puzzle->pmasks [row][column], puzzle->pcolumnMasks [column]); IFT(puzzle->pmasks [row][column], puzzle->pblockMasks [row/3][column/3]); } } } } #if defined(DEBUG) fprintf ( logFile, "} = %d /* enterClues () */\n", status ); fflush ( logFile ); #endif return ( status ); }
((BlobProperties *)dataToFillIn)->bobSqrtOverlapFactor = sqrt(((BlobProperties *)dataToFillIn)->bobOverlapFactor); } void scriptSetBlobBiggestRadius(char *directory,char *field,void *dataToFillIn) { sscanf(field,"%f",&((BlobProperties *)dataToFillIn)->bobBiggestRadius); ((BlobProperties *)dataToFillIn)->bobBiggestRadiusDefault = ((BlobProperties *)dataToFillIn)->bobBiggestRadius; } /*============================================================================= Update table here: =============================================================================*/ scriptEntry Tweaks[] = { makeEntry(TM_TechListFont, scriptSetStringCB), makeEntry(TM_Font, scriptSetStringCB), makeEntry(TM_StandardTextColor, scriptSetRGBCB), makeEntry(TM_CantAffordTextColor, scriptSetRGBCB), makeEntry(TM_SelectionTextColor, scriptSetRGBCB), makeEntry(TM_SelectionRectColor, scriptSetRGBCB), makeEntry(cmFloatRefundRatio,scriptSetReal32CB), makeEntry(shipsRetaliate,scriptSetBool), makeEntry(singleMachineNumPlayers,scriptSetUwordCB), makeEntry(DefaultScenario,scriptSetStringCB), makeEntry(useMission,scriptSetStringCB), makeEntry(RETALIATE_ZONE,scriptSetReal32CB), makeEntry(R1BulletColor,scriptSetRGBCB), makeEntry(R2BulletColor,scriptSetRGBCB), makeEntry(BLAST_CONSTANT,scriptSetReal32CB), makeEntry(BLAST_RADIUS_MULTIPLE_DEFAULT,scriptSetReal32CB),
///These are all the record types we know how to read. static std::map<std::string,RecordFactoryEntry> makeFactory() { std::map<std::string,RecordFactoryEntry> newFactory; newFactory.insert(makeEntry("NiNode", &construct <NiNode> , RC_NiNode )); newFactory.insert(makeEntry("NiSwitchNode", &construct <NiSwitchNode> , RC_NiSwitchNode )); newFactory.insert(makeEntry("NiLODNode", &construct <NiLODNode> , RC_NiLODNode )); newFactory.insert(makeEntry("AvoidNode", &construct <NiNode> , RC_AvoidNode )); newFactory.insert(makeEntry("NiBSParticleNode", &construct <NiNode> , RC_NiBSParticleNode )); newFactory.insert(makeEntry("NiBSAnimationNode", &construct <NiNode> , RC_NiBSAnimationNode )); newFactory.insert(makeEntry("NiBillboardNode", &construct <NiNode> , RC_NiBillboardNode )); newFactory.insert(makeEntry("NiTriShape", &construct <NiTriShape> , RC_NiTriShape )); newFactory.insert(makeEntry("NiRotatingParticles", &construct <NiRotatingParticles> , RC_NiRotatingParticles )); newFactory.insert(makeEntry("NiAutoNormalParticles", &construct <NiAutoNormalParticles> , RC_NiAutoNormalParticles )); newFactory.insert(makeEntry("NiCamera", &construct <NiCamera> , RC_NiCamera )); newFactory.insert(makeEntry("RootCollisionNode", &construct <NiNode> , RC_RootCollisionNode )); newFactory.insert(makeEntry("NiTexturingProperty", &construct <NiTexturingProperty> , RC_NiTexturingProperty )); newFactory.insert(makeEntry("NiFogProperty", &construct <NiFogProperty> , RC_NiFogProperty )); newFactory.insert(makeEntry("NiMaterialProperty", &construct <NiMaterialProperty> , RC_NiMaterialProperty )); newFactory.insert(makeEntry("NiZBufferProperty", &construct <NiZBufferProperty> , RC_NiZBufferProperty )); newFactory.insert(makeEntry("NiAlphaProperty", &construct <NiAlphaProperty> , RC_NiAlphaProperty )); newFactory.insert(makeEntry("NiVertexColorProperty", &construct <NiVertexColorProperty> , RC_NiVertexColorProperty )); newFactory.insert(makeEntry("NiShadeProperty", &construct <NiShadeProperty> , RC_NiShadeProperty )); newFactory.insert(makeEntry("NiDitherProperty", &construct <NiDitherProperty> , RC_NiDitherProperty )); newFactory.insert(makeEntry("NiWireframeProperty", &construct <NiWireframeProperty> , RC_NiWireframeProperty )); newFactory.insert(makeEntry("NiSpecularProperty", &construct <NiSpecularProperty> , RC_NiSpecularProperty )); newFactory.insert(makeEntry("NiStencilProperty", &construct <NiStencilProperty> , RC_NiStencilProperty )); newFactory.insert(makeEntry("NiVisController", &construct <NiVisController> , RC_NiVisController )); newFactory.insert(makeEntry("NiGeomMorpherController", &construct <NiGeomMorpherController> , RC_NiGeomMorpherController )); newFactory.insert(makeEntry("NiKeyframeController", &construct <NiKeyframeController> , RC_NiKeyframeController )); newFactory.insert(makeEntry("NiAlphaController", &construct <NiAlphaController> , RC_NiAlphaController )); newFactory.insert(makeEntry("NiUVController", &construct <NiUVController> , RC_NiUVController )); newFactory.insert(makeEntry("NiPathController", &construct <NiPathController> , RC_NiPathController )); newFactory.insert(makeEntry("NiMaterialColorController", &construct <NiMaterialColorController> , RC_NiMaterialColorController )); newFactory.insert(makeEntry("NiBSPArrayController", &construct <NiBSPArrayController> , RC_NiBSPArrayController )); newFactory.insert(makeEntry("NiParticleSystemController", &construct <NiParticleSystemController> , RC_NiParticleSystemController )); newFactory.insert(makeEntry("NiFlipController", &construct <NiFlipController> , RC_NiFlipController )); newFactory.insert(makeEntry("NiAmbientLight", &construct <NiLight> , RC_NiLight )); newFactory.insert(makeEntry("NiDirectionalLight", &construct <NiLight> , RC_NiLight )); newFactory.insert(makeEntry("NiPointLight", &construct <NiPointLight> , RC_NiLight )); newFactory.insert(makeEntry("NiSpotLight", &construct <NiSpotLight> , RC_NiLight )); newFactory.insert(makeEntry("NiTextureEffect", &construct <NiTextureEffect> , RC_NiTextureEffect )); newFactory.insert(makeEntry("NiVertWeightsExtraData", &construct <NiVertWeightsExtraData> , RC_NiVertWeightsExtraData )); newFactory.insert(makeEntry("NiTextKeyExtraData", &construct <NiTextKeyExtraData> , RC_NiTextKeyExtraData )); newFactory.insert(makeEntry("NiStringExtraData", &construct <NiStringExtraData> , RC_NiStringExtraData )); newFactory.insert(makeEntry("NiGravity", &construct <NiGravity> , RC_NiGravity )); newFactory.insert(makeEntry("NiPlanarCollider", &construct <NiPlanarCollider> , RC_NiPlanarCollider )); newFactory.insert(makeEntry("NiParticleGrowFade", &construct <NiParticleGrowFade> , RC_NiParticleGrowFade )); newFactory.insert(makeEntry("NiParticleColorModifier", &construct <NiParticleColorModifier> , RC_NiParticleColorModifier )); newFactory.insert(makeEntry("NiParticleRotation", &construct <NiParticleRotation> , RC_NiParticleRotation )); newFactory.insert(makeEntry("NiFloatData", &construct <NiFloatData> , RC_NiFloatData )); newFactory.insert(makeEntry("NiTriShapeData", &construct <NiTriShapeData> , RC_NiTriShapeData )); newFactory.insert(makeEntry("NiVisData", &construct <NiVisData> , RC_NiVisData )); newFactory.insert(makeEntry("NiColorData", &construct <NiColorData> , RC_NiColorData )); newFactory.insert(makeEntry("NiPixelData", &construct <NiPixelData> , RC_NiPixelData )); newFactory.insert(makeEntry("NiMorphData", &construct <NiMorphData> , RC_NiMorphData )); newFactory.insert(makeEntry("NiKeyframeData", &construct <NiKeyframeData> , RC_NiKeyframeData )); newFactory.insert(makeEntry("NiSkinData", &construct <NiSkinData> , RC_NiSkinData )); newFactory.insert(makeEntry("NiUVData", &construct <NiUVData> , RC_NiUVData )); newFactory.insert(makeEntry("NiPosData", &construct <NiPosData> , RC_NiPosData )); newFactory.insert(makeEntry("NiRotatingParticlesData", &construct <NiRotatingParticlesData> , RC_NiRotatingParticlesData )); newFactory.insert(makeEntry("NiAutoNormalParticlesData", &construct <NiAutoNormalParticlesData> , RC_NiAutoNormalParticlesData )); newFactory.insert(makeEntry("NiSequenceStreamHelper", &construct <NiSequenceStreamHelper> , RC_NiSequenceStreamHelper )); newFactory.insert(makeEntry("NiSourceTexture", &construct <NiSourceTexture> , RC_NiSourceTexture )); newFactory.insert(makeEntry("NiSkinInstance", &construct <NiSkinInstance> , RC_NiSkinInstance )); return newFactory; }
udword ROOM_MIN_THRESHOLD = 1; udword ROOM_MAX_THRESHOLD = 50; unsigned long WAIT_SHUTDOWN_MS = 1000; void scriptSetIPStrings(char *directory,char *field,void *dataToFillIn); void scriptSetPortNumbers(char *directory,char *field,void *dataToFillIn); extern sdword TimedOutWaitingForPauseAcksGiveUpAfterNumTimes; extern real32 HorseRacePlayerDropoutTime; extern color HorseRaceDropoutColor; scriptEntry NetTweaks[] = { makeEntry(PATCHBARCOLOR,scriptSetRGBCB), makeEntry(PATCHBAROUTLINECOLOR,scriptSetRGBCB), makeEntry(TITAN_PICKER_REFRESH_TIME,scriptSetReal32CB), makeEntry(TITAN_GAME_EXPIRE_TIME,scriptSetUwordCB), makeEntry(TITAN_CHANNEL_EXPIRE_TIME,scriptSetUdwordCB), makeEntry(DIRSERVER_NUM, scriptSetUdwordCB), makeEntry(PATCHSERVER_NUM, scriptSetUdwordCB), makeEntry(DIRSERVER_PORTS,scriptSetPortNumbers), makeEntry(PATCHSERVER_PORTS,scriptSetPortNumbers), makeEntry(DIRSERVER_IPSTRINGS,scriptSetIPStrings), makeEntry(PATCHSERVER_IPSTRINGS,scriptSetIPStrings), makeEntry(GAME_PORT,scriptSetUdwordCB), makeEntry(T1_Timeout,scriptSetReal32CB), makeEntry(T2_Timeout,scriptSetReal32CB), makeEntry(TWAITFORPAUSEACKS_Timeout,scriptSetReal32CB), makeEntry(TimedOutWaitingForPauseAcksGiveUpAfterNumTimes,scriptSetSdwordCB),
typedef enum { alodOK, alodGoingDown, alodGoingUp, alodGotDown } alodState_t; static alodState_t alodState; static bool alodEnabled; sdword alodDownDelta = 0; scriptEntry AutoLODTweaks[] = { makeEntry(alodScaleFactorDelta, scriptSetReal32CB), makeEntry(alodFastMinScale, scriptSetReal32CB), makeEntry(alodFastMaxScale, scriptSetReal32CB), makeEntry(alodFastTargetPolys, scriptSetUdwordCB), makeEntry(alodFastTargetDelta, scriptSetUdwordCB), makeEntry(alodSlowMinScale, scriptSetReal32CB), makeEntry(alodSlowMaxScale, scriptSetReal32CB), makeEntry(alodSlowTargetPolys, scriptSetUdwordCB), makeEntry(alodSlowTargetDelta, scriptSetUdwordCB), END_SCRIPT_ENTRY }; /*============================================================================= Code
sdword BUILD_RCONTROLLER_CASH_BASE = 1500; sdword BUILD_ASF_CASH_BASE = 2000; real32 ASF_POSITION_TO_ENEMY_MOTHERSHIP = 0.4f; real32 RCONTROLLER_POS_FACTOR_FRIENDLIES_PRESENT = 1.1f; real32 RCONTROLLER_POS_FACTOR_ENEMIESPRESENT_BUT_OUTNUMBERED = 0.6f; real32 RCONTROLLER_POS_FACTOR_ENEMIESPRESENT = 0.3f; real32 RCONTROLLER_POS_FACTOR_INBETWEEN = 1.0f; real32 RCONTROLLER_POS_FACTOR_NOTINBETWEEN = 0.1f; scriptEntry AIResourceManTweaks[] = { makeEntry(UPDATE_RU_COUNT_RATE,scriptSetUdwordCB), makeEntry(BUILD_RC_CASH_TABLE_BASE,scriptSetSdwordCB), makeEntry(BUILD_RC_CASH_TABLE_INC,scriptSetSdwordCB), makeEntry(MAX_RCOLLECTORS_PER_DOCK_POINT,scriptSetSdwordCB), makeEntry(MAX_RCOLLECTORS_TO_BUILD,scriptSetSdwordCB), makeEntry(MIN_WORTHWHILE_RUs,scriptSetSdwordCB), makeEntry(RUs_PER_RCOLLECTOR,scriptSetSdwordCB), makeEntry(MIN_WORTHWHILE_RUs_FOR_CONTROLLER,scriptSetSdwordCB), makeEntry(MIN_RCOLLECTORS_FOR_CONTROLLER,scriptSetSdwordCB), makeEntry(BUILD_RCONTROLLER_CASH_BASE,scriptSetSdwordCB), makeEntry(ASF_POSITION_TO_ENEMY_MOTHERSHIP,scriptSetReal32CB), makeEntry(BUILD_ASF_CASH_BASE,scriptSetSdwordCB), makeEntry(RCONTROLLER_POS_FACTOR_FRIENDLIES_PRESENT,scriptSetReal32CB), makeEntry(RCONTROLLER_POS_FACTOR_ENEMIESPRESENT_BUT_OUTNUMBERED,scriptSetReal32CB), makeEntry(RCONTROLLER_POS_FACTOR_ENEMIESPRESENT,scriptSetReal32CB), makeEntry(RCONTROLLER_POS_FACTOR_INBETWEEN,scriptSetReal32CB),