Exemple #1
0
int main()
{
    VisionCam * gCam = NULL;
    entryIndex index = 0;
    module_t handle = NULL;
    status_e ret = STATUS_SUCCESS;

#if defined(SOSAL_RUNTIME_DEBUG)
    debug_get_zone_mask("SOSAL_ZONE_MASK", &sosal_zone_mask);
#endif

#if defined(DVP_RUNTIME_DEBUG)
    debug_get_zone_mask("DVP_ZONE_MASK", &dvp_zone_mask);
#endif

    handle =  initModule( &gCam );
#ifdef VCAM_AS_SHARED
    if( handle == NULL )
        return -1;
#endif

    if( gCam )
    {
        setInitialValues( gCam );
        ret = startServices( gCam );
    }
    else
    {
        ret = STATUS_CATASTROPHIC;
    }

    if( ret !=  STATUS_SUCCESS )
    {
        ret = deinitModule( handle, &gCam );
    }
    else
    {
        while( 1 )
        {
            index = Menu( menu );
            if( index == -1 )
            {
                continue;
            }

            /// 'q' button (quit) is pressed
            if( menu[ index ]->ID == VCAM_CMD_QUIT )
            {
                index = getEntryIndex( menu , KEY_PREVIEW_STOP );
                ret = executeEntry( menu[ index ], gCam );
                break;
            }
            ret = executeEntry( menu[ index ] , gCam );
        }
        ret = stopServices( gCam );
        ret = deinitModule( handle, &gCam );
    }

    printf("\tvcam_test exiting with %d.\n", ret);

    if( STATUS_SUCCESS != ret )
        puts("\tTerminating application.");

    return ret;
}
Exemple #2
0
void GameConversations::update(bool flag) {
	// Only need to proceed if there is an active conversation
	if (!active())
		return;

	ConversationVar &var0 = _runningConv->_cnd._vars[0];

	switch (_currentMode) {
	case CONVMODE_0:
		assert(var0.isNumeric());
		if (var0._val < 0) {
			if (_vm->_game->_scene._frameStartTime >= _startFrameNumber) {
				removeActiveWindow();
				if (_heroTrigger) {
					_vm->_game->_scene._action._activeAction._verbId = _verbId;
					_vm->_game->_trigger = _heroTrigger;
					_vm->_game->_triggerMode = _heroTriggerMode;
					_heroTrigger = 0;
				}

				_currentMode = CONVMODE_STOP;
			}
		} else {
			bool isActive = nextNode();
			_currentNode = var0._val;

			if (isActive) {
				_verbId = _runningConv->_data._nodes[_currentNode]._index;
				_vm->_game->_scene._action._activeAction._verbId = _verbId;
				_vm->_game->_scene._action._inProgress = true;
				_vm->_game->_scene._action._savedFields._commandError = false;
				_currentMode = CONVMODE_1;
			} else {
				_currentMode = generateMenu();
			}
		}
		break;

	case CONVMODE_1:
		if (flag)
			_currentMode = CONVMODE_3;
		break;

	case CONVMODE_2:
		if (flag) {
			_vm->_game->_player._stepEnabled = false;
			_verbId = _vm->_game->_scene._action._activeAction._verbId;

			if (!(_runningConv->_cnd._entryFlags[_verbId] & ENTRYFLAG_2))
				flagEntry(CMD_HIDE, _verbId);

			removeActiveWindow();
			_vm->_game->_scene._userInterface.emptyConversationList();
			_vm->_game->_scene._userInterface.setup(kInputConversation);
			_personSpeaking = 0;
			executeEntry(_verbId);

			ConvDialog &dialog = _runningConv->_data._dialogs[_verbId];
			if (dialog._speechIndex) {
				_runningConv->_cnd._messageList3.clear();
				_runningConv->_cnd._messageList3.push_back(dialog._speechIndex);
			}

			generateText(dialog._textLineIndex, _runningConv->_cnd._messageList3);
			_currentMode = CONVMODE_0;

			if (_heroTrigger) {
				_vm->_game->_scene._action._activeAction._verbId = _verbId;
				_vm->_game->_trigger = _heroTrigger;
				_vm->_game->_triggerMode = _heroTriggerMode;
				_heroTrigger = 0;
			}
		}
		break;

	case CONVMODE_3:
		if (_vm->_game->_scene._frameStartTime >= _startFrameNumber) {
			removeActiveWindow();
			_personSpeaking = 0;
			executeEntry(_verbId);
			generateMessage(_runningConv->_cnd._messageList1, _runningConv->_cnd._messageList3);
		
			if (_heroTrigger && _popupVisible) {
				_vm->_game->_scene._action._activeAction._verbId = _verbId;
				_vm->_game->_trigger = _heroTrigger;
				_vm->_game->_triggerMode = _heroTriggerMode;
				_heroTrigger = 0;
			}

			_currentMode = CONVMODE_4;
		}
		break;

	case CONVMODE_4:
		if (_vm->_game->_scene._frameStartTime >= _startFrameNumber) {
			removeActiveWindow();
			_personSpeaking = _speakerVal;

			generateMessage(_runningConv->_cnd._messageList2, _runningConv->_cnd._messageList4);

			if (_interlocutorTrigger && _popupVisible) {
				_vm->_game->_scene._action._activeAction._verbId = _verbId;
				_vm->_game->_trigger = _interlocutorTrigger;
				_vm->_game->_triggerMode = _interlocutorTriggerMode;
				_interlocutorTrigger = 0;
			}
		}
		break;

	case CONVMODE_STOP:
		stop();
		break;

	default:
		break;
	}

	warning("TODO: GameConversations::update");
}