diff options
-rw-r--r-- | jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.projects/0.84/.markers | bin | 698 -> 1253 bytes | |||
-rw-r--r-- | jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources | bin | 668 -> 752 bytes | |||
-rw-r--r-- | jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache | bin | 508 -> 508 bytes | |||
-rw-r--r-- | jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml | 12 | ||||
-rw-r--r-- | jeu-test/Lemmini/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml | 320 | ||||
-rw-r--r-- | sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_integrees.c | 54 | ||||
-rw-r--r-- | sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c | 53 | ||||
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/netlem.c | 1 | ||||
-rw-r--r-- | src/parser/Makefile | 10 | ||||
-rw-r--r-- | src/parser/ginit.h | 275 | ||||
-rw-r--r-- | src/parser/parse_ini.lex | 19 | ||||
-rw-r--r-- | src/parser/parse_ini.yy | 430 |
13 files changed, 730 insertions, 448 deletions
diff --git a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.projects/0.84/.markers b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.projects/0.84/.markers Binary files differindex b84034d..090b1b0 100644 --- a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.projects/0.84/.markers +++ b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.projects/0.84/.markers diff --git a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources Binary files differindex 2d8478b..206dcda 100644 --- a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources +++ b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources diff --git a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache Binary files differindex a8e2592..7b08a1e 100644 --- a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache +++ b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache diff --git a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml index ad7fc67..7e1fe39 100644 --- a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml +++ b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml @@ -6,8 +6,18 @@ <item value="false" key="linkWithEditor"/> <item value="2" key="layout"/> <item value="1" key="rootMode"/> - <item value="<?xml version="1.0" encoding="UTF-8"?>
<packageExplorer group_libraries="1" layout="2" linkWithEditor="0" rootMode="1" workingSetName="Aggregate for window 1289070009225">
<customFilters userDefinedPatternsEnabled="false">
<xmlDefinedFilters>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.StaticsFilter" isEnabled="false"/>
<child filterId="org.eclipse.pde.ui.ExternalPluginLibrariesFilter1" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.FieldsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter" isEnabled="true"/>
<child filterId="org.eclipse.pde.ui.BinaryProjectFilter1" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter" isEnabled="true"/>
</xmlDefinedFilters>
</customFilters>
</packageExplorer>" key="memento"/> + <item value="<?xml version="1.0" encoding="UTF-8"?>
<packageExplorer group_libraries="1" layout="2" linkWithEditor="0" rootMode="1" workingSetName="Aggregate for window 1289066501714">
<customFilters userDefinedPatternsEnabled="false">
<xmlDefinedFilters>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.StaticsFilter" isEnabled="false"/>
<child filterId="org.eclipse.pde.ui.ExternalPluginLibrariesFilter1" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.FieldsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter" isEnabled="true"/>
<child filterId="org.eclipse.pde.ui.BinaryProjectFilter1" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter" isEnabled="true"/>
</xmlDefinedFilters>
</customFilters>
</packageExplorer>" key="memento"/> + </section> + <section name="completion_proposal_size"> </section> <section name="JavaElementSearchActions"> </section> + <section name="BuildPathsPropertyPage"> + <item value="0" key="pageIndex"/> + </section> + <section name="JavaSearchPage"> + <item value="false" key="CASE_SENSITIVE"/> + <item value="11" key="INCLUDE_MASK"/> + <item value="0" key="HISTORY_SIZE"/> + </section> </section> diff --git a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml index d9f0764..a80276c 100644 --- a/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml +++ b/jeu-test/Lemmini/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml @@ -1,42 +1,59 @@ <?xml version="1.0" encoding="UTF-8"?> -<workbench progressCount="10" version="2.0"> +<workbench progressCount="18" version="2.0"> <workbenchAdvisor/> -<window height="768" width="1024" x="0" y="25"> +<window height="768" maximized="true" width="1024" x="0" y="25"> <fastViewData fastViewLocation="1024"/> <perspectiveBar> -<itemSize x="160"/> +<itemSize x="330"/> </perspectiveBar> <coolbarLayout locked="0"> <coolItem id="group.file" itemType="typeGroupMarker"/> -<coolItem id="org.eclipse.ui.workbench.file" itemType="typeToolBarContribution" x="104" y="30"/> +<coolItem id="org.eclipse.ui.workbench.file" itemType="typeToolBarContribution" x="138" y="30"/> <coolItem id="additions" itemType="typeGroupMarker"/> <coolItem id="org.eclipse.debug.ui.launchActionSet" itemType="typeToolBarContribution" x="120" y="30"/> <coolItem id="org.eclipse.jdt.ui.JavaElementCreationActionSet" itemType="typeToolBarContribution" x="104" y="30"/> <coolItem id="org.eclipse.search.searchActionSet" itemType="typeToolBarContribution" x="76" y="30"/> +<coolItem id="org.eclipse.ui.edit.text.actionSet.presentation" itemType="typeToolBarContribution" x="124" y="30"/> <coolItem id="group.nav" itemType="typeGroupMarker"/> <coolItem id="org.eclipse.ui.workbench.navigate" itemType="typeToolBarContribution" x="184" y="30"/> <coolItem id="group.editor" itemType="typeGroupMarker"/> +<coolItem id="org.eclipse.jdt.ui.ClassFileEditor" itemType="typePlaceholder" x="-1" y="-1"/> +<coolItem id="org.eclipse.jdt.ui.CompilationUnitEditor" itemType="typeToolBarContribution" x="-1" y="-1"/> <coolItem id="group.help" itemType="typeGroupMarker"/> <coolItem id="org.eclipse.ui.workbench.help" itemType="typeToolBarContribution" x="-1" y="-1"/> </coolbarLayout> -<page aggregateWorkingSetId="Aggregate for window 1289070009225" focus="true" label="Workspace - Java"> +<page aggregateWorkingSetId="Aggregate for window 1289066501714" focus="true" label="Workspace - Java"> <editors> <editorArea activeWorkbook="DefaultEditorWorkbook"> <info part="DefaultEditorWorkbook"> <folder appearance="1" expanded="2"> -<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory"/> +<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory"> +<part id="0"/> +</presentation> </folder> </info> </editorArea> +<editor activePart="true" focus="true" id="org.eclipse.jdt.ui.CompilationUnitEditor" name="Lemmini.java" partName="Lemmini.java" path="/home/geekplusplus/Bureau/Projet-Lemmings/trunk/jeu-test/Lemmini/0.84/src/Lemmini.java" title="Lemmini.java" tooltip="0.84/src/Lemmini.java" workbook="DefaultEditorWorkbook"> +<input factoryID="org.eclipse.ui.part.FileEditorInputFactory" path="/0.84/src/Lemmini.java"/> +<editorState selectionHorizontalPixel="0" selectionLength="0" selectionOffset="19787" selectionTopPixel="8945"/> +</editor> </editors> <views> <view id="org.eclipse.jdt.ui.TypeHierarchy" partName="Hierarchy"/> +<view id="org.eclipse.search.ui.views.SearchView" partName="Search"> +<viewState isPinned="false"> +<view IMemento.internal.id="" org.eclipse.search.lastActivation="0"/> +<view IMemento.internal.id="org.eclipse.search.text.FileSearchResultPage" org.eclipse.search.lastActivation="1" org.eclipse.search.resultpage.layout="2" org.eclipse.search.resultpage.limit="1000" org.eclipse.search.resultpage.sorting="2"/> +</viewState> +</view> +<view id="org.eclipse.debug.ui.DebugView" partName="Debug"> +<viewState/> +</view> <view id="org.eclipse.ui.views.ProblemView" partName="Problems"> <viewState PRIMARY_SORT_FIELD="org.eclipse.ui.ide.severityAndDescriptionField" categoryGroup="org.eclipse.ui.ide.severity" markerContentGenerator="org.eclipse.ui.ide.problemsGenerator" partName="Problems"> -<expanded> -<category IMemento.internal.id="Warnings (2 items)"/> +<expanded>
<category IMemento.internal.id="Errors (100 items)"/> </expanded> -<columnWidths org.eclipse.ui.ide.locationField="73" org.eclipse.ui.ide.markerType="108" org.eclipse.ui.ide.pathField="143" org.eclipse.ui.ide.resourceField="108" org.eclipse.ui.ide.severityAndDescriptionField="350"/> +<columnWidths org.eclipse.ui.ide.locationField="73" org.eclipse.ui.ide.markerType="657" org.eclipse.ui.ide.pathField="143" org.eclipse.ui.ide.resourceField="108" org.eclipse.ui.ide.severityAndDescriptionField="350"/> <visible IMemento.internal.id="org.eclipse.ui.ide.severityAndDescriptionField"/> <visible IMemento.internal.id="org.eclipse.ui.ide.resourceField"/> <visible IMemento.internal.id="org.eclipse.ui.ide.pathField"/> @@ -48,7 +65,7 @@ <viewState/> </view> <view id="org.eclipse.jdt.ui.PackageExplorer" partName="Package Explorer"> -<viewState group_libraries="1" layout="2" linkWithEditor="0" rootMode="1" workingSetName="Aggregate for window 1289070009225"> +<viewState group_libraries="1" layout="2" linkWithEditor="0" rootMode="1" workingSetName="Aggregate for window 1289066501714"> <customFilters userDefinedPatternsEnabled="false"> <xmlDefinedFilters> <child filterId="org.eclipse.jdt.ui.PackageExplorer.LibraryFilter" isEnabled="false"/> @@ -76,6 +93,15 @@ </customFilters> </viewState> </view> +<view id="org.eclipse.debug.ui.BreakpointView" partName="Breakpoints"> +<viewState> +<isTrackingSelection value="false"/> +</viewState> +</view> +<view id="org.eclipse.debug.ui.VariableView" partName="Variables"> +<viewState/> +</view> +<view id="org.eclipse.ui.views.TaskList" partName="Tasks"/> <view id="org.eclipse.ui.views.ContentOutline" partName="Outline"> <viewState/> </view> @@ -154,16 +180,15 @@ </presentation> </folder> </info> -<info folder="true" part="org.eclipse.ui.internal.ViewStack@1286d597" ratio="0.7495049" ratioLeft="757" ratioRight="253" relationship="2" relative="left"> +<info folder="true" part="stickyFolderRight" ratio="0.7495049" ratioLeft="757" ratioRight="253" relationship="2" relative="left"> <folder appearance="2" expanded="2"> <page content="org.eclipse.help.ui.HelpView" label="LabelNotFound"/> <page content="org.eclipse.ui.internal.introview" label="LabelNotFound"/> <page content="org.eclipse.ui.cheatsheets.views.CheatSheetView" label="LabelNotFound"/> -<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory"/> </folder> </info> <info part="org.eclipse.ui.editorss" ratio="0.24950495" ratioLeft="252" ratioRight="758" relationship="2" relative="left"/> -<info folder="true" part="bottom" ratio="0.7488226" ratioLeft="477" ratioRight="160" relationship="4" relative="org.eclipse.ui.editorss"> +<info folder="true" part="bottom" ratio="0.582762" ratioLeft="595" ratioRight="426" relationship="4" relative="org.eclipse.ui.editorss"> <folder activePageID="org.eclipse.ui.console.ConsoleView" appearance="2" expanded="2"> <page content="org.eclipse.ui.views.ProblemView" label="Problems"/> <page content="org.eclipse.jdt.ui.JavadocView" label="Javadoc"/> @@ -180,7 +205,7 @@ </presentation> </folder> </info> -<info folder="true" part="right" ratio="0.74934036" ratioLeft="568" ratioRight="190" relationship="2" relative="org.eclipse.ui.editorss"> +<info folder="true" part="right" ratio="0.7863568" ratioLeft="1049" ratioRight="285" relationship="2" relative="org.eclipse.ui.editorss"> <folder activePageID="org.eclipse.ui.views.ContentOutline" appearance="2" expanded="2"> <page content="org.eclipse.ui.views.ContentOutline" label="Outline"/> <page content="org.eclipse.ui.texteditor.TemplatesView" label="LabelNotFound"/> @@ -193,9 +218,262 @@ </mainWindow> </layout> </perspective> +<perspective editorAreaTrimState="2" editorAreaVisible="1" fixed="0" version="0.016"> +<descriptor class="org.eclipse.debug.internal.ui.DebugPerspectiveFactory" id="org.eclipse.debug.ui.DebugPerspective" label="Debug"/> +<alwaysOnActionSet id="org.eclipse.ui.cheatsheets.actionSet"/> +<alwaysOnActionSet id="org.eclipse.search.searchActionSet"/> +<alwaysOnActionSet id="org.eclipse.ui.edit.text.actionSet.annotationNavigation"/> +<alwaysOnActionSet id="org.eclipse.ui.edit.text.actionSet.navigation"/> +<alwaysOnActionSet id="org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo"/> +<alwaysOnActionSet id="org.eclipse.ui.externaltools.ExternalToolsSet"/> +<alwaysOnActionSet id="org.eclipse.ui.actionSet.keyBindings"/> +<alwaysOnActionSet id="org.eclipse.ui.actionSet.openFiles"/> +<alwaysOnActionSet id="org.eclipse.debug.ui.launchActionSet"/> +<alwaysOnActionSet id="org.eclipse.ui.NavigateActionSet"/> +<alwaysOnActionSet id="org.eclipse.debug.ui.breakpointActionSet"/> +<alwaysOnActionSet id="org.eclipse.jdt.debug.ui.JDTDebugActionSet"/> +<alwaysOnActionSet id="org.eclipse.jdt.ui.JavaActionSet"/> +<alwaysOnActionSet id="org.eclipse.debug.ui.debugActionSet"/> +<show_view_action id="org.eclipse.debug.ui.DebugView"/> +<show_view_action id="org.eclipse.debug.ui.VariableView"/> +<show_view_action id="org.eclipse.debug.ui.BreakpointView"/> +<show_view_action id="org.eclipse.debug.ui.ExpressionView"/> +<show_view_action id="org.eclipse.ui.views.ContentOutline"/> +<show_view_action id="org.eclipse.ui.console.ConsoleView"/> +<show_view_action id="org.eclipse.ui.views.TaskList"/> +<show_view_action id="org.eclipse.ant.ui.views.AntView"/> +<show_view_action id="org.eclipse.pde.runtime.LogView"/> +<show_view_action id="org.eclipse.jdt.debug.ui.DisplayView"/> +<perspective_action id="org.eclipse.jdt.ui.JavaPerspective"/> +<perspective_action id="org.eclipse.jdt.ui.JavaBrowsingPerspective"/> +<hide_toolbar_item_id id="org.eclipse.ui.edit.text.toggleShowSelectedElementOnly"/> +<view id="org.eclipse.ui.console.ConsoleView"/> +<view id="org.eclipse.ui.views.TaskList"/> +<view id="org.eclipse.search.ui.views.SearchView"/> +<view id="org.eclipse.debug.ui.DebugView"/> +<view id="org.eclipse.debug.ui.VariableView"/> +<view id="org.eclipse.debug.ui.BreakpointView"/> +<view id="org.eclipse.ui.views.ContentOutline"/> +<fastViewBars/> +<layout> +<mainWindow> +<info folder="true" part="org.eclipse.debug.internal.ui.NavigatorFolderView"> +<folder activePageID="org.eclipse.debug.ui.DebugView" appearance="2" expanded="2"> +<page content="org.eclipse.debug.ui.DebugView" label="Debug"/> +<page content="org.eclipse.ui.views.ResourceNavigator" label="LabelNotFound"/> +<page content="org.eclipse.jdt.ui.PackageExplorer" label="LabelNotFound"/> +<page content="org.eclipse.jdt.ui.TypeHierarchy" label="LabelNotFound"/> +<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory"> +<part id="0"/> +</presentation> +</folder> +</info> +<info folder="true" part="stickyFolderRight" ratio="0.75" ratioLeft="1194" ratioRight="398" relationship="2" relative="org.eclipse.debug.internal.ui.NavigatorFolderView"> +<folder appearance="2" expanded="2"> +<page content="org.eclipse.help.ui.HelpView" label="LabelNotFound"/> +<page content="org.eclipse.ui.internal.introview" label="LabelNotFound"/> +<page content="org.eclipse.ui.cheatsheets.views.CheatSheetView" label="LabelNotFound"/> +</folder> +</info> +<info folder="true" part="org.eclipse.debug.internal.ui.ConsoleFolderView" ratio="0.75" ratioLeft="768" ratioRight="256" relationship="4" relative="org.eclipse.debug.internal.ui.NavigatorFolderView"> +<folder activePageID="org.eclipse.ui.console.ConsoleView" appearance="2" expanded="2"> +<page content="org.eclipse.ui.console.ConsoleView" label="Console"/> +<page content="org.eclipse.ui.views.TaskList" label="Tasks"/> +<page content="org.eclipse.search.ui.views.SearchView" label="Search"/> +<page content="org.eclipse.ui.views.BookmarkView" label="LabelNotFound"/> +<page content="org.eclipse.ui.views.PropertySheet" label="LabelNotFound"/> +<page content="org.eclipse.jdt.debug.ui.DisplayView" label="LabelNotFound"/> +<page content="org.eclipse.search.SearchResultView" label="LabelNotFound"/> +<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory"> +<part id="0"/> +<part id="1"/> +<part id="2"/> +</presentation> +</folder> +</info> +<info part="org.eclipse.ui.editorss" ratio="0.4527559" ratioLeft="345" ratioRight="417" relationship="4" relative="org.eclipse.debug.internal.ui.NavigatorFolderView"/> +<info folder="true" part="org.eclipse.debug.internal.ui.OutlineFolderView" ratio="0.75" ratioLeft="1194" ratioRight="398" relationship="2" relative="org.eclipse.ui.editorss"> +<folder activePageID="org.eclipse.ui.views.ContentOutline" appearance="2" expanded="2"> +<page content="org.eclipse.ui.views.ContentOutline" label="Outline"/> +<page content="org.eclipse.ant.ui.views.AntView" label="LabelNotFound"/> +<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory"> +<part id="0"/> +</presentation> +</folder> +</info> +<info folder="true" part="org.eclipse.debug.internal.ui.ToolsFolderView" ratio="0.5" ratioLeft="796" ratioRight="796" relationship="2" relative="org.eclipse.debug.internal.ui.NavigatorFolderView"> +<folder activePageID="org.eclipse.debug.ui.BreakpointView" appearance="2" expanded="2"> +<page content="org.eclipse.debug.ui.VariableView" label="Variables"/> +<page content="org.eclipse.debug.ui.BreakpointView" label="Breakpoints"/> +<page content="org.eclipse.debug.ui.ExpressionView" label="LabelNotFound"/> +<page content="org.eclipse.debug.ui.RegisterView" label="LabelNotFound"/> +<presentation id="org.eclipse.ui.presentations.WorkbenchPresentationFactory"> +<part id="0"/> +<part id="1"/> +</presentation> +</folder> +</info> +</mainWindow> +</layout> +</perspective> </perspectives> <workingSets/> -<navigationHistory/> +<navigationHistory> +<editors> +<editor factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" path="/0.84/src/Lemmini.java"/> +<editor factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" path="/0.84/src/Game/GameController.java"/> +</editors> +<item historyLabel="GameController.java" index="1"> +<position info="not_deleted" x="12192" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="4927" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5446" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5507" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5608" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5639" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5710" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5791" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5820" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5850" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5915" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="5980" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6013" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6049" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6080" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6136" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6226" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6277" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6305" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6337" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6367" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6403" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6454" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6496" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6661" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6695" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6748" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6808" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8509" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8560" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8596" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8651" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8716" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8777" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8596" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8811" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8849" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8892" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="8980" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="19805" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="9284" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="17007" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="19374" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="19407" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="19668" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="19534" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6209" y="7"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="6140" y="0"/> +</item> +<item historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="19374" y="0"/> +</item> +<item active="true" historyLabel="Lemmini.java" index="0"> +<position info="not_deleted" x="19787" y="0"/> +</item> +</navigationHistory> <input factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/" type="8"/> </page> <workbenchWindowAdvisor/> @@ -211,5 +489,15 @@ </trimArea> </trimLayout> </window> -<mruList/> +<mruList> +<file factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" name="MiscGfx.java" tooltip="0.84/src/Game/MiscGfx.java"> +<persistable path="/0.84/src/Game/MiscGfx.java"/> +</file> +<file factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" name="GameController.java" tooltip="0.84/src/Game/GameController.java"> +<persistable path="/0.84/src/Game/GameController.java"/> +</file> +<file factoryID="org.eclipse.jdt.ui.ClassFileEditorInputFactory" id="org.eclipse.jdt.ui.ClassFileEditor" name="ImageFetcher.class" tooltip="sun.awt.image.ImageFetcher"> +<persistable org.eclipse.jdt.ui.ClassFileIdentifier="=0.84/\/usr\/lib\/jvm\/java-6-sun-1.6.0.20\/jre\/lib\/rt.jar<sun.awt.image(ImageFetcher.class"/> +</file> +</mruList> </workbench>
\ No newline at end of file diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_integrees.c b/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_integrees.c index 6d115b4..d8bd6e0 100644 --- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_integrees.c +++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_integrees.c @@ -51,3 +51,57 @@ int init() return 0; } +Uint32 string_to_Uint32 (char* c,int taille){ + + Uint32 u32c; + int i,n,lc = strlen(c); + int t[taille]; + if(lc-3 != taille){ + //-DEBUG-printf("ERREUR: wrong format .. expect (strlen[%s] - 3)==%d but it's = %d\n",c,taille,lc-3); + return(ccc_error); + } + u32c = 0; + for(i=0;i<taille;++i){ + n = c[i+2]; + //-DEBUG-printf("n = %d, %c\n",n); + if (n > 47 && n < 58 ) { t[i]=(n - 48) ;} + if (n > 64 && n < 71 ) { t[i]=(n - 55) ;} + if (n > 96 && n < 103 ){ t[i]=(n - 87) ;} + } + n=0; + for(i=0;i<taille;++i){ + //-DEBUG-printf("t[%d]= %d, *(%d), %d\n",i,t[i],(1<<(4*(taille-i-1))),t[i]*(1<<(4*(taille-i-1))) ); + + n+=t[i]*(1<<(4*(taille-i-1))); + + + //-DEBUG-printf("n= %d\n",n); + } + u32c= n & 0xffffff; + return u32c; +} + + +// "4,5,6,7" -> un tableau de Uint32 +Uint32* tab_of_string_to_Uint32 (char* c, int taille){ + int i,lc = strlen(c); + char t[10]; + int cpt=0; + int cpt2=0; + Uint32* tab=malloc(sizeof(Uint32)*(lc/(taille+3))); + t[0]='0';t[1]='x';t[8]=',';t[9]=0; + + for(i=0;i<lc;++i){ + // token + if(c[i]=='x'){cpt=0;} + if(cpt<6){ + t[cpt+2]=c[i+1]; + ++cpt; + if(cpt==6){ + tab[cpt2]=string_to_Uint32(t,taille); + cpt2++; + } + } + } + return tab; +} diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c b/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c index 26e1699..47e0379 100644 --- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c +++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c @@ -1,58 +1,5 @@ // Est inclus en direct dans parse_ini.yy -Uint32 string_to_Uint32 (char* c,int taille){ - - Uint32 u32c; - int i,n,lc = strlen(c); - int t[taille]; - if(lc-3 != taille){ - //-DEBUG-printf("ERREUR: wrong format .. expect (strlen[%s] - 3)==%d but it's = %d\n",c,taille,lc-3); - return(ccc_error); - } - u32c = 0; - for(i=0;i<taille;++i){ - n = c[i+2]; - //-DEBUG-printf("n = %d, %c\n",n); - if (n > 47 && n < 58 ) { t[i]=(n - 48) ;} - if (n > 64 && n < 71 ) { t[i]=(n - 55) ;} - if (n > 96 && n < 103 ){ t[i]=(n - 87) ;} - } - n=0; - for(i=0;i<taille;++i){ - //-DEBUG-printf("t[%d]= %d, *(%d), %d\n",i,t[i],(1<<(4*(taille-i-1))),t[i]*(1<<(4*(taille-i-1))) ); - - n+=t[i]*(1<<(4*(taille-i-1))); - - - //-DEBUG-printf("n= %d\n",n); - } - u32c= n & 0xffffff; - return u32c; -} - - -Uint32* tab_of_string_to_Uint32 (char* c, int taille){ - int i,lc = strlen(c); - char t[10]; - int cpt=0; - int cpt2=0; - Uint32* tab=malloc(sizeof(Uint32)*(lc/(taille+3))); - t[0]='0';t[1]='x';t[8]=',';t[9]=0; - - for(i=0;i<lc;++i){ - // token - if(c[i]=='x'){cpt=0;} - if(cpt<6){ - t[cpt+2]=c[i+1]; - ++cpt; - if(cpt==6){ - tab[cpt2]=string_to_Uint32(t,taille); - cpt2++; - } - } - } - return tab; -} /* inverse la liste fournie en parametre et la renvoie */ struct listeSimplementChainee* rev_listeO (struct listeSimplementChainee* liste) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 52cff76..dd99fcf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,9 +26,9 @@ configure_file ( # add the binary tree to the search path for include files # so that we will find netlem.h and netlem_ds.h include_directories("${INCLUDE_DIRECTORIES}" "${PROJECT_BINARY_DIR}") -add_definitions(-Wall -Wextra -pedantic -Werror -std=c99 -g) +add_definitions(-Wall -Wextra -pedantic -Werror -std=c99 -D_POSIX_SOURCE -g) -add_executable(netlem WIN32 netlem.c ${SRC_COMMON}) +add_executable(netlem WIN32 netlem.c ${SRC_COMMON} parser/lex.yy.c parser/y.tab.c ) target_link_libraries(netlem SDL SDL_net) add_executable(netlem_ds WIN32 netlem_ds.c ${SRC_COMMON}) diff --git a/src/netlem.c b/src/netlem.c index beba79c..cedbf93 100644 --- a/src/netlem.c +++ b/src/netlem.c @@ -140,7 +140,6 @@ int main(int argc, char **argv) { switch(getOrChangeState(eNull,NULL)) { case eMultiLoading: - printf("DEBUG : loadProgress==%i\n", loadProgress); if(loadProgress==100) { getOrChangeState(eMultiWaitLoading,client.sockClient); } diff --git a/src/parser/Makefile b/src/parser/Makefile new file mode 100644 index 0000000..bcf6618 --- /dev/null +++ b/src/parser/Makefile @@ -0,0 +1,10 @@ +all: lex.yy.c y.tab.c + +lex.yy.c: parse_ini.lex + flex parse_ini.lex +y.tab.c: parse_ini.yy + yacc -v -d parse_ini.yy + +clean: + -rm y.output y.tab.c y.tab.h lex.yy.c y.tab.c + diff --git a/src/parser/ginit.h b/src/parser/ginit.h new file mode 100644 index 0000000..ccdd6b9 --- /dev/null +++ b/src/parser/ginit.h @@ -0,0 +1,275 @@ + + enum eMapStyle { + brick , bubble , crystal , dirt , fire , marble , + pillar , rock , snow , special, undefined + }; + + char tabString_eMapStyle[NBR_STYLE_MAP][10] = { + "brick" , "bubble" , "crystal" , "dirt" , "fire" , "marble" , + "pillar" , "rock" , "snow" , "special", "undefined" + }; + + struct colorMap { + Uint32 bgColor;// background color present in "style".ini + Uint32 debrisColor;// debris color present in "style".ini + Uint32* particleColor; //particle color present in "style".ini + }; + + struct spriteObjet { + // ID == Objet.ID + int state; // number of state in terraino_XX.gif; + + // animation types + // 0 - don't animate + // 1 - animate continously + // 2 - trap - animate on trigger - else show first pic + // 3 - entry animation: animate once at level start + int anim; + + // object types + // 0 - passive + // 3 - no digging to the left + // 4 - no digging to the right + // 5 - trap which makes lemmings drown (water/quick sand/mud) + // 6 - trap which replaces lemming with death animation + // 7 - trap which triggers lemming death animation + // 8 - exit + // 32 - entry + int type; + + int sound; // numero of sound + }; + + struct mapStyle { + enum eMapStyle style; // map' style + int superLemming; // off = 0; on = 1; + int tiles; // number of terrain_XX.gif present in "style".ini + int tilesObjet; //number of terraino_XX.gif + int tilesSteel; // number of terrainom_XX.gif + + struct colorMap cmap; // level's info's color + + struct spriteObjet* tabDataSprO; // sprite'data ; default=NULL; + SDL_Surface **tabGif; // all gif are stored in; default=NULL; + }; + // FIN: MAP_STRUCTURE + + // DEBUT: LEMMINGS_STRUCTURE + // LEM_JOB == lemm_XX.gif + + +#define MAX_LEM_FALL 3 +#define MAX_LEM_FALL_FLOATER 2 +#define FALLER_MAX 126 +#define FLOATER_TO_FALLER 32 +#define MAX_LEM_FLOATER 2 + + /** a jumper moves up two pixels per frame */ +#define MAX_JUMPER_STEP 2 + /** if a walker jumps up 6 pixels, it becomes a jumper */ +#define MAX_JUMPER_JUMP 4 +#define MAX_BUILD_BRICK 9 +#define MAX_BUILD_END 3 + +#define WALKER_OBSTACLE_HEIGHT 14 +#define FALLER_STEP 3 +#define FLOATER_STEP 2 +#define FALL_DISTANCE_FALL 8 +#define FALL_DISTANCE_FORCE_FALL 2 * FALL_DISTANCE_FALL +#define FALL_DISTANCE_FLOAT 32 +#define JUMPER_STEP 2 +#define WALKER_STEP 1 +#define CLIMBER_STEP 1 +#define BASHER_FALL_DISTANCE 6 +#define STEPS_WARNING 9 +#define STEPS_MAX 12 + +#define LEM_JOB 17 + //0: walker + //1: faller + //2: climber + //3: climber_to_walker + //4: floater + //5: splat + //6: stopper + //7: drowning + //8: trap_death + //9: exIt + //10: bomber + //11: builder + //12: builder_end + //13: digger + //14: basher + //15: miner + //16: jumper +#define OTHER_LEM_JOB 6 + //17: died + //18: enter + //19: safe + //20: nuke + //21: bomber_stopper + //22: floater_start +#define TOTAL_LEM_JOB LEM_JOB + OTHER_LEM_JOB + + + enum eLemmingJob { + walker , faller , climber , climber_to_walker , floater , + splat , stopper , drowning , trap_death , exIt , bomber, + builder , builder_end , digger , basher , miner , jumper , + died , enter , safe , nuke , bomber_stopper , floater_start + }; + + char tabString_eLemmingJob[TOTAL_LEM_JOB][20] = { + "walker" , "faller" , "climber" , "climber_to_walker" , "floater" , + "splat" , "stopper" , "drowning" , "trap_death" , "exIt" , "bomber", + "builder" , "builder_end , digger" , "basher" , "miner" , "jumper", + "died" , "enter" , "safe" , "nuke", "bomber_stopper", "floater_start" + }; + + struct lemmingMask { + // ID == lemming.ID; + int stateM; // number of state in mask_XX.gif; + int dirM; // number of direction + int cooldown; // after <cooldown> animations of lemming animation, do mask action and increase mask frame idx + }; + + struct lemmingImask { + // ID == lemming.ID; + int stateI; // number of state in imask_XX.gif; + int dirI; // number of direction + }; + + struct lemmingJobAndSprite { + // ID == lemming.ID; + int state; // number of state in lemm_XX.gif; + int dir; // direction of lemming: 0=left(do FlipLR); 1=right; default=1; + int anim; // animation type: 0=loop, 1=once (state change if finished); + + // foot: director 's foot for collision 's test + // calcul the X' symetry if lemming.dir==0(left) + int footX; // position X of right's lemming's foot; + int footY; // position Y of right's lemming's foot; + int footSize; // size of lemming's foot; + + // mask for screen ... + struct lemmingMask* mask; // mask of this job; default=NULL; + struct lemmingImask* imask; // imask of this job; default=NULL; + }; + // FIN: LEMMINGS_STRUCTURE + + // DEBUT: INFOMAP +#define IDENT_COUNT 12 + + enum eParaMap { + releaseRate,numLemmings,numToRescue,timeLimit, + numClimbers,numFloaters,numBombers,numBlockers,numBuilders, + numBashers,numMiners,numDiggers + }; + + char tabString_eParaMap[IDENT_COUNT][32] = { + "releaseRate","numLemmings","numToRescue","timeLimit", + "numClimbers","numFloaters","numBombers","numBlockers", + "numBuilders","numBashers","numMiners","numDiggers" + }; + + struct infoMap { + char* name; // map name; default=NULL; + int paraMap[IDENT_COUNT]; // some parameter of this map + int xPos; // camera started position + int MaxFallDistance; // max pixel lemming fall before died;default=0; + int nuke; // hiroshima= 1; default =0; + int nbrEntry; // number of entry in this map; default=0; + struct mapStyle map; // map + struct lemmingJobAndSprite *lemmingDATA; // DATA of lemmingJob; default=NULL; + }; + // FIN: INFOMAP + + // DEBUT: GAMEINIT + struct paraTerrain { + int modif; //modifier: 8=NO_OVERWRITE, 4=UPSIDE_DOWN, 2=REMOVE (combining allowed, 0=FULL); + }; + + struct paraObjet { + int UD; // upside down (0,1); + int paintMode;// paint modes: 8=VIS_ON_TERRAIN, 4=NO_OVERWRITE, 0=FULL (only one value possible) + int cptState; // count number of frame for an animation at once, default=0; + }; + + struct paraSteel { + int w;// weight + int h;// height + }; + + struct paraLemming { + int dir; // direction of lemming; default=1; + int climber; // skill climber; default = 0; + int blocker; // skill blocker; default = 0; + int bomber; // skill bomber; default = -1; + int floater; // skill floater; default = 0; + int nuke; // nuked or not; default=0; + int cptFall; // count number of pixel when lemming falling;default = 0; + int cptFall2;// count number of pixel when lemming falling;default = 0; + int cptJump; // count number of pixel when lemming jumping;default = 0; + int cptBrick; // count number of brick ;default = 0; + int cptBoom; // count number of boom ;default = -1; + int cptState; // count number of frame for an animation at once, default=0; + }; + + struct listeSimplementChainee { + int ID; // ID for tabGif; + int x; // x position; + int y; // y position; + + union listeDataType { + struct paraTerrain *pt; // other para about terrain; default=NULL; + struct paraObjet *po; // other para about objet; default=NULL; + struct paraSteel *ps; // other para about steel; default=NULL; + struct paraLemming *pl; // other para about lemming; default=NULL; + } data; + + struct listeSimplementChainee *next;// default=NULL; + }; + + struct terrain { + int nbr; // number of terrain on this map; default=0; + struct listeSimplementChainee *lt; // list of terrain; default=NULL; + }; + + struct objet { + int nbr; // number of objet on this map; default=0; + struct listeSimplementChainee *lo; // list of objet; default=NULL; + }; + + struct steel { + int nbr; // number of steel on this map; default=0; + struct listeSimplementChainee *ls; // list of steel; default=NULL; + }; + + struct lemming { + int nbrInput; // number of lemming will be create; default=0; + int nbr; // number of lemming on this map; default=0; + int nbrDied; // number of lemming Died on this map; default=0; + int nbrSafe; // number of lemming Saved on this map; default=0; + struct listeSimplementChainee *ll; // list of lemming; default=NULL; + }; + + // game use some cpt +#define NBR_CPT 20 + + struct gameInit { + struct infoMap mapI; // all DATA of the map; + struct terrain t; // all DATA of terrain on this map; + struct objet o; // all DATA of objet on this map; + struct steel s; // all DATA of steel on this map; + struct lemming l; // all DATA of lemming on this map; +/* + // 0-13 : BUTTON_LEMMING state button 0: off; 1: on; + // 14 : CURSOR STATE + // 15 : FREE CPT: for all need it ...; default=0; + // 16 : NBR_ENTRY OPEN; default=0; + // 17 : clic on mouse on lemning skill; default=-1; + // 18 : clic on mouse on lemning;default=0; + int cptGame[NBR_CPT]; // default=0; +*/ + }; + // FIN: GAMEINIT diff --git a/src/parser/parse_ini.lex b/src/parser/parse_ini.lex index 6a376f9..9298543 100644 --- a/src/parser/parse_ini.lex +++ b/src/parser/parse_ini.lex @@ -1,8 +1,12 @@ %{ -#include "y.tab.h" +#include <stdio.h> #include <string.h> + +#include "y.tab.h" + #define MAX_STR_LEN 255 + int string(int tok) { int lg = strlen(yytext); if ( lg > MAX_STR_LEN ) { @@ -15,6 +19,7 @@ } %} +%option noinput %option nounput %option noyywrap @@ -44,8 +49,7 @@ COMMENT "#"[^\n]* return EOL; } -<INI_VALUE>{NUMBER}{BLANK}*{COMMENT}? - { +<INI_VALUE>{NUMBER}{BLANK}*{COMMENT}? { yylval.num = atoi(yytext); return INT; } @@ -69,7 +73,7 @@ COMMENT "#"[^\n]* return SLEM; } -"bgColor"i { +"bgColor" { BEGIN(STR_M); return BGCOLOR; } @@ -84,17 +88,14 @@ COMMENT "#"[^\n]* return PARTICLECOLOR; } -<STR_M>{BLANK}*"="{BLANK}* - { +<STR_M>{BLANK}*"="{BLANK}* { BEGIN(STR_MM); return AFF; } <STR_M>{BLANK}* <STR_MM>{BLANK}* - -<STR_MM>{BLANK}*[^\n]* - { +<STR_MM>{BLANK}*[^\n]* { BEGIN(INITIAL); return string(STR); } diff --git a/src/parser/parse_ini.yy b/src/parser/parse_ini.yy index cba649c..9e01c27 100644 --- a/src/parser/parse_ini.yy +++ b/src/parser/parse_ini.yy @@ -21,34 +21,22 @@ // 8+(99-releaseRate) should be correct //releaseBase = 8 + (99 - releaseRate); - extern FILE *yyin; - - const int TIME_WAIT_TRAP_START = 15000; // milliseconde - const int INTERFACE_HEIGHT = 150;//200; - //Les attributs de l'écran (640 * 480) - const int SCREEN_WIDTH = 800;//1280 - const int SCREEN_HEIGHT = 500; // 480 //SCREEN_HEIGHT = LEVEL_HEIGHT + INTERFACE_HEIGHT + 30; - const int SCREEN_BPP = 32; +#define TIME_WAIT_TRAP_START 15000 // milliseconde - //MINIMAP - /* -#define MINIMAP_X0 420 //636 -#define MINIMAP_Y0 365 -#define MINIMAP_MX 210 //464 -#define MINIMAP_MY 48 //120*/ +#define INTERFACE_HEIGHT 150 #define MINIMAP_X0 420 #define MINIMAP_Y0 325 #define MINIMAP_MX 350 #define MINIMAP_MY 175 - const int INTER_BUTTON_X = 0; - const int INTER_BUTTON_Y = 50; +#define INTER_BUTTON_X 0 +#define INTER_BUTTON_Y 50 //Les dimensions du niveau - const int LEVEL_WIDTH = 1664*2; - const int LEVEL_HEIGHT = 160*2; +#define LEVEL_WIDTH (1664*2) +#define LEVEL_HEIGHT (160*2) // Decale le tableau d'objet //0: lemmfont.gif @@ -74,8 +62,10 @@ #define NBR_ADD_OBJ 19 //9-21 : icone_XX.gif #define NBR_BUTTON_LEMMING 13 - const int ADD_OBJ = NBR_ADD_OBJ + NBR_BUTTON_LEMMING; +#define ADD_OBJ (NBR_ADD_OBJ+NBR_BUTTON_LEMMING) +//FIXME : pas de variables pour les couleurs +/* //cyan pixel color Uint32 ccc_cyan= 0x00ffff; //yellow pixel color @@ -141,22 +131,12 @@ Uint32 ccc_lStopperLeft = 0xffbbcb; Uint32 ccc_lStopperRight = 0xffcccb; - +*/ // Config Cam - const int CAM_VITESSE = 8; - const int BOUND_SENSIBILITE = 50; - - - - //Les surfaces - - SDL_Surface *pTerrain = NULL; //Fond avec juste la map - SDL_Surface *pSpr_Lem = NULL; // Fond + lemmings + animations - SDL_Surface *screen = NULL; // Ecran via la caméra - SDL_Surface *pStencil= NULL; // Ecran Stencil - SDL_Surface *pStencilFixe= NULL; // Ecran Stencil Fixe +#define CAM_VITESSE 8 +#define BOUND_SENSIBILITE 50 struct list_int { int val; @@ -174,288 +154,18 @@ #define NBR_STYLE_MAP 11 #define PARTICULE_COUNT 16 - enum eMapStyle { - brick , bubble , crystal , dirt , fire , marble , - pillar , rock , snow , special, undefined - }; - - char tabString_eMapStyle[NBR_STYLE_MAP][10] = { - "brick" , "bubble" , "crystal" , "dirt" , "fire" , "marble" , - "pillar" , "rock" , "snow" , "special", "undefined" - }; - - struct colorMap { - Uint32 bgColor;// background color present in "style".ini - Uint32 debrisColor;// debris color present in "style".ini - Uint32* particleColor; //particle color present in "style".ini - }; - - struct spriteObjet { - // ID == Objet.ID - int state; // number of state in terraino_XX.gif; - - // animation types - // 0 - don't animate - // 1 - animate continously - // 2 - trap - animate on trigger - else show first pic - // 3 - entry animation: animate once at level start - int anim; - - // object types - // 0 - passive - // 3 - no digging to the left - // 4 - no digging to the right - // 5 - trap which makes lemmings drown (water/quick sand/mud) - // 6 - trap which replaces lemming with death animation - // 7 - trap which triggers lemming death animation - // 8 - exit - // 32 - entry - int type; - - int sound; // numero of sound - }; - - struct mapStyle { - enum eMapStyle style; // map' style - int superLemming; // off = 0; on = 1; - int tiles; // number of terrain_XX.gif present in "style".ini - int tilesObjet; //number of terraino_XX.gif - int tilesSteel; // number of terrainom_XX.gif - - struct colorMap cmap; // level's info's color - - struct spriteObjet* tabDataSprO; // sprite'data ; default=NULL; - SDL_Surface **tabGif; // all gif are stored in; default=NULL; - }; - // FIN: MAP_STRUCTURE - - // DEBUT: LEMMINGS_STRUCTURE - // LEM_JOB == lemm_XX.gif - - -#define MAX_LEM_FALL 3 -#define MAX_LEM_FALL_FLOATER 2 -#define FALLER_MAX 126 -#define FLOATER_TO_FALLER 32 -#define MAX_LEM_FLOATER 2 - - /** a jumper moves up two pixels per frame */ -#define MAX_JUMPER_STEP 2 - /** if a walker jumps up 6 pixels, it becomes a jumper */ -#define MAX_JUMPER_JUMP 4 -#define MAX_BUILD_BRICK 9 -#define MAX_BUILD_END 3 - -#define WALKER_OBSTACLE_HEIGHT 14 -#define FALLER_STEP 3 -#define FLOATER_STEP 2 -#define FALL_DISTANCE_FALL 8 -#define FALL_DISTANCE_FORCE_FALL 2 * FALL_DISTANCE_FALL -#define FALL_DISTANCE_FLOAT 32 -#define JUMPER_STEP 2 -#define WALKER_STEP 1 -#define CLIMBER_STEP 1 -#define BASHER_FALL_DISTANCE 6 -#define STEPS_WARNING 9 -#define STEPS_MAX 12 - -#define LEM_JOB 17 - //0: walker - //1: faller - //2: climber - //3: climber_to_walker - //4: floater - //5: splat - //6: stopper - //7: drowning - //8: trap_death - //9: exIt - //10: bomber - //11: builder - //12: builder_end - //13: digger - //14: basher - //15: miner - //16: jumper -#define OTHER_LEM_JOB 6 - //17: died - //18: enter - //19: safe - //20: nuke - //21: bomber_stopper - //22: floater_start -#define TOTAL_LEM_JOB LEM_JOB + OTHER_LEM_JOB - - - enum eLemmingJob { - walker , faller , climber , climber_to_walker , floater , - splat , stopper , drowning , trap_death , exIt , bomber, - builder , builder_end , digger , basher , miner , jumper , - died , enter , safe , nuke , bomber_stopper , floater_start - }; - - char tabString_eLemmingJob[TOTAL_LEM_JOB][20] = { - "walker" , "faller" , "climber" , "climber_to_walker" , "floater" , - "splat" , "stopper" , "drowning" , "trap_death" , "exIt" , "bomber", - "builder" , "builder_end , digger" , "basher" , "miner" , "jumper", - "died" , "enter" , "safe" , "nuke", "bomber_stopper", "floater_start" - }; - - struct lemmingMask { - // ID == lemming.ID; - int stateM; // number of state in mask_XX.gif; - int dirM; // number of direction - int cooldown; // after <cooldown> animations of lemming animation, do mask action and increase mask frame idx - }; - - struct lemmingImask { - // ID == lemming.ID; - int stateI; // number of state in imask_XX.gif; - int dirI; // number of direction - }; - - struct lemmingJobAndSprite { - // ID == lemming.ID; - int state; // number of state in lemm_XX.gif; - int dir; // direction of lemming: 0=left(do FlipLR); 1=right; default=1; - int anim; // animation type: 0=loop, 1=once (state change if finished); - - // foot: director 's foot for collision 's test - // calcul the X' symetry if lemming.dir==0(left) - int footX; // position X of right's lemming's foot; - int footY; // position Y of right's lemming's foot; - int footSize; // size of lemming's foot; - - // mask for screen ... - struct lemmingMask* mask; // mask of this job; default=NULL; - struct lemmingImask* imask; // imask of this job; default=NULL; - }; - // FIN: LEMMINGS_STRUCTURE - - // DEBUT: INFOMAP -#define IDENT_COUNT 12 - - enum eParaMap { - releaseRate,numLemmings,numToRescue,timeLimit, - numClimbers,numFloaters,numBombers,numBlockers,numBuilders, - numBashers,numMiners,numDiggers - }; - - char tabString_eParaMap[IDENT_COUNT][32] = { - "releaseRate","numLemmings","numToRescue","timeLimit", - "numClimbers","numFloaters","numBombers","numBlockers", - "numBuilders","numBashers","numMiners","numDiggers" - }; - - struct infoMap { - char* name; // map name; default=NULL; - int paraMap[IDENT_COUNT]; // some parameter of this map - int xPos; // camera started position - int MaxFallDistance; // max pixel lemming fall before died;default=0; - int nuke; // hiroshima= 1; default =0; - int nbrEntry; // number of entry in this map; default=0; - struct mapStyle map; // map - struct lemmingJobAndSprite *lemmingDATA; // DATA of lemmingJob; default=NULL; - }; - // FIN: INFOMAP - - // DEBUT: GAMEINIT - struct paraTerrain { - int modif; //modifier: 8=NO_OVERWRITE, 4=UPSIDE_DOWN, 2=REMOVE (combining allowed, 0=FULL); - }; - - struct paraObjet { - int UD; // upside down (0,1); - int paintMode;// paint modes: 8=VIS_ON_TERRAIN, 4=NO_OVERWRITE, 0=FULL (only one value possible) - int cptState; // count number of frame for an animation at once, default=0; - }; - - struct paraSteel { - int w;// weight - int h;// height - }; - - struct paraLemming { - int dir; // direction of lemming; default=1; - int climber; // skill climber; default = 0; - int blocker; // skill blocker; default = 0; - int bomber; // skill bomber; default = -1; - int floater; // skill floater; default = 0; - int nuke; // nuked or not; default=0; - int cptFall; // count number of pixel when lemming falling;default = 0; - int cptFall2;// count number of pixel when lemming falling;default = 0; - int cptJump; // count number of pixel when lemming jumping;default = 0; - int cptBrick; // count number of brick ;default = 0; - int cptBoom; // count number of boom ;default = -1; - int cptState; // count number of frame for an animation at once, default=0; - }; - - struct listeSimplementChainee { - int ID; // ID for tabGif; - int x; // x position; - int y; // y position; - - union listeDataType { - struct paraTerrain *pt; // other para about terrain; default=NULL; - struct paraObjet *po; // other para about objet; default=NULL; - struct paraSteel *ps; // other para about steel; default=NULL; - struct paraLemming *pl; // other para about lemming; default=NULL; - } data; - - struct listeSimplementChainee *next;// default=NULL; - }; - - struct terrain { - int nbr; // number of terrain on this map; default=0; - struct listeSimplementChainee *lt; // list of terrain; default=NULL; - }; - - struct objet { - int nbr; // number of objet on this map; default=0; - struct listeSimplementChainee *lo; // list of objet; default=NULL; - }; - - struct steel { - int nbr; // number of steel on this map; default=0; - struct listeSimplementChainee *ls; // list of steel; default=NULL; - }; - - struct lemming { - int nbrInput; // number of lemming will be create; default=0; - int nbr; // number of lemming on this map; default=0; - int nbrDied; // number of lemming Died on this map; default=0; - int nbrSafe; // number of lemming Saved on this map; default=0; - struct listeSimplementChainee *ll; // list of lemming; default=NULL; - }; - - // game use some cpt -#define NBR_CPT 20 - - struct gameInit { - struct infoMap mapI; // all DATA of the map; - struct terrain t; // all DATA of terrain on this map; - struct objet o; // all DATA of objet on this map; - struct steel s; // all DATA of steel on this map; - struct lemming l; // all DATA of lemming on this map; - // 0-13 : BUTTON_LEMMING state button 0: off; 1: on; - // 14 : CURSOR STATE - // 15 : FREE CPT: for all need it ...; default=0; - // 16 : NBR_ENTRY OPEN; default=0; - // 17 : clic on mouse on lemning skill; default=-1; - // 18 : clic on mouse on lemning;default=0; - int cptGame[NBR_CPT]; // default=0; - }; - // FIN: GAMEINIT +#include "ginit.h" //FIN NEW CONCEPTION enum sens { UD , LR }; + extern FILE *yyin; extern int yylineno; // Bidouille pour avoir le numero de ligne du lexer ^^ - int yylex(); void yyerror(struct gameInit *gInit, char *s); +/* SDL_Surface *load_image( char* filename, Uint32 cbg ); // void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip ); @@ -555,65 +265,66 @@ int miniMap (SDL_Surface *s, int x0, int y0, float coefX, float coefY); int paint_stencil=0; +*/ - %} +%} - %parse-param { struct gameInit *gInit } +%parse-param { struct gameInit *gInit } - %union {char* str; int num; struct list_int *ints; struct val *val;} +%union {char* str; int num; struct list_int *ints; struct val *val;} - %token LEXERROR - %token STYLE - %token NAME - %token SLEM - %token BGCOLOR - %token DEBRISCOLOR - %token PARTICLECOLOR - %token AFF - %token XC - %token EOL - %token VIR - %token <str> IDENT - %token <str> STR - %token <num> INT +%token LEXERROR +%token STYLE +%token NAME +%token SLEM +%token BGCOLOR +%token DEBRISCOLOR +%token PARTICLECOLOR +%token AFF +%token XC +%token EOL +%token VIR +%token <str> IDENT +%token <str> STR +%token <num> INT - %type <ints> extra_vals - %type <val> val +%type <ints> extra_vals +%type <val> val - %start ini +%start ini - %% +%% - ini: - | ini decl - | ini EOL +ini: +| ini decl +| ini EOL - decl: STYLE AFF val { - int ok=0; - enum eMapStyle s; // STYLE - ////-DEBUG-printf("Le style\n"); - if ( $3->type != 0 ) { - //-DEBUG-printf("ERREUR: Fichier .ini corrompu (style n'est pas de style int)\n"); - } else { - s=0; - while(s<NBR_STYLE_MAP){ +decl: STYLE AFF val { + int ok=0; + enum eMapStyle s; // STYLE + ////-DEBUG-printf("Le style\n"); + if ( $3->type != 0 ) { + //-DEBUG-printf("ERREUR: Fichier .ini corrompu (style n'est pas de style int)\n"); + } else { + s=0; + while(s<NBR_STYLE_MAP){ - if ( (strcmp($3->ptr.str,"undefined")!=0)&& - (strcmp($3->ptr.str,tabString_eMapStyle[s]) == 0 ) ){ + if ( (strcmp($3->ptr.str,"undefined")!=0)&& + (strcmp($3->ptr.str,tabString_eMapStyle[s]) == 0 ) ){ - ok=2; - gInit->mapI.map.style=s; - break; - } - ++s; - } - if (ok!=2) { - // BUG ... - //-DEBUG-printf("Style [%s] invalide (undefined) !!\n",$3->ptr.str); - exit(2); + ok=2; + gInit->mapI.map.style=s; + break; } + ++s; + } + if (ok!=2) { + // BUG ... + //-DEBUG-printf("Style [%s] invalide (undefined) !!\n",$3->ptr.str); + exit(2); } } +} | NAME AFF val { ////-DEBUG-printf("Le name \n"); gInit->mapI.name=$3->ptr.str; //FIXME @@ -944,14 +655,11 @@ extra_vals: { $$=NULL; } } %% - -void yyerror(struct gameInit *gInit, char *s) -{ - //fprintf(stderr, "Syntax Error : '%s' at l%d,c%d-l%d,c%d\n", s, @$.first_column, @$.last_line, @$.last_column); // Nécessite l'option %locations et un lexer qui va bien +void yyerror(struct gameInit *gInit, char *s) { fprintf(stderr, "(stdin):%i: error: %s\n", yylineno, s); exit(9); } - +/* #include "fonctions_integrees.c" #include "fonctions_non_integrees.c" @@ -1008,16 +716,6 @@ int main (int argc, char **argv) fprintf(stderr,"Filename INVALIDE: %s\n",temp); perror("Impossible d'ouvrir le niveau"); return(48); } - /* - for(i=0;i<256;++i){ - for(j=0;j<256;++j){ - for(k=0;k<256;++k){ - ctest = ((i<<16 | j<<8 | k) & 0xffffff); - //-DEBUG-printf("[i]=%d, R = %X G = %X B = %X\n", - i, ((ctest>>16) & 0xff), - ((ctest>>8) & 0xff), - (ctest & 0xff) ); - }}}*/ res=lancement(); printf("code retour %d\n",res); @@ -1026,5 +724,5 @@ int main (int argc, char **argv) return res; } - +*/ |